You are viewing a single comment's thread. Return to all comments →
Your solution is good but it will take O(nlogn) time due to sorting which can be optimized to O(n)
Here is the video explanation of my solution in O(n) time -
Any comments and feedback will be appreciated.
Thanks for that. I worked out a solution where I do it in O(n) time. Posted on your video.
most welcome. :)
If you dont mind can you please provide a feedback on my video by commenting or liking & disliking. It will help me and others too to find the solution over internet.