The problem: Sherlock and numbersis tagged under binary search but I am really confused how binary search would be used here. Can anyone help me in understanding this problem with binary search point of view?
You dont really need Binary Search. Its not a question where Binary Search is natural/needed, especially because a O(K) time solution exists. But still if you want it, its on lines of binary search in interval [1,N] and then check how many elements of array are <=mid.
1 Like