Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
@Yuval Filmus Looking at YF's answer, he has a 2nd array B, which is, like, cheating. If array A is [ 1003, 1002, 1001 ], and B[i] is the number of elements in A which are at most i, we have B = [ 0, 0, 0 ]. ?
Prima facia, binary search does not work for unsorted lists. Are you saying it DOES work? If so, I would like to reproduce it and examine it. I think someone is neglecting the fact of "unsorted".