You are viewing a single comment's thread. Return to all comments →
Hi,
Your solution is good and simlpe but it will take O(nlogn) time due to sorting which can be optimized further to O(n).
Here is the video explaination of my solution in O(n) time -
https://youtu.be/3hvzKDJQypI
Seems like cookies are disabled on this browser, please enable them to open this website
Angry Professor
You are viewing a single comment's thread. Return to all comments →
Hi,
Your solution is good and simlpe but it will take O(nlogn) time due to sorting which can be optimized further to O(n).
Here is the video explaination of my solution in O(n) time -
https://youtu.be/3hvzKDJQypI