Today, an interviewer asked me this question. My immediate response was that we could simply do a linear search, comparing the current element with the previous element in t
Can be done in O(log N) with a modified binary search:
Start in the middle of the array: If array[idx] < idx the duplicate is to the left, otherwise to the right. Rinse and repeat.