Sep-22-2020, 04:42 AM
The idea is easy to understand, take the list
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]If you remove 0, 1, 2, 3 or 4, then L[4] has value 5. On the other hand, if you remove 5, 6, 7, 8 or 9, then L[4] has value 4. Hence by checking the value of L[4], you can say if the missing value is in range(0, 5) or in range(5, 10). The algorithm then repeats the same argument for the subarrays.