You are viewing a single comment's thread. Return to all comments →
Binary search for every element is O(nlogn). For this problem (arr[i] belongs to [0, 20000] we can use a bucket, hence O(n) time space.
(arr[i] belongs to [0, 20000]
https://www.hackerrank.com/challenges/beautiful-triplets/forum/comments/588430
Seems like cookies are disabled on this browser, please enable them to open this website
Beautiful Triplets
You are viewing a single comment's thread. Return to all comments →
Binary search for every element is O(nlogn). For this problem
(arr[i] belongs to [0, 20000]we can use a bucket, hence O(n) time space.https://www.hackerrank.com/challenges/beautiful-triplets/forum/comments/588430