[1, 4, 6, 8, 9] could have become [8, 9, 1, 4, 6]. The result is the array values.
Return the index of value in values, or -1 if it is not there. Your solution must run in O(log n).values=[15, 18, 22, 3, 7, 11], value=7 → 4
The sorted list [3, 7, 11, 15, 18, 22] was shifted to start at 15. The 7 is at index 4.
values=[15, 18, 22, 3, 7, 11], value=16 → -1
There is no 16, so the answer is -1.
values=[2, 9], value=2 → 0
values are distinctvalues is an increasing array, possibly shifted cyclicallyvalues=[15, 18, 22, 3, 7, 11], value=7
4
Run checks the first 3 tests in your browser. Submit checks all 125 tests on the server, hidden ones included.