Loading...
Loading...
Loading...
A sorted list of distinct integers was rotated, so some front part moved to the back, for example 30 40 50 10 20. Print its smallest value without scanning the whole list.
Example
Input
5 30 40 50 10 20
Output
10
Try the problem first. Open one hint at a time.
Compare the middle value with the last value of the window. If the middle is larger, the drop is on its right.
If the middle is not larger, it could itself be the smallest, so keep it with hi = mid.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor