Rotated Shift Start
mediumA 24/7 ops team logs server load snapshots in a circular buffer. The values were strictly increasing, but the buffer wrapped: at some point the sequence was rotated, so it now reads like [4, 5, 6, 7, 0, 1, 2] — two sorted runs glued together (possibly zero rotation, leaving it fully sorted).
Given the rotated list loads (distinct values), return the minimum value in O(log n).
Example 1
in loads = [3, 4, 5, 1, 2]
out 1
Example 2
in loads = [4, 5, 6, 7, 0, 1, 2]
out 0
Example 3
in loads = [11, 13, 15, 17]
out 11
Zero rotation — already sorted.
Constraints
- · 1 <= len(loads) <= 2000
- · -10^4 <= loads[i] <= 10^4
- · all values distinct
- · loads is a rotation of a sorted list
solution.py● loading python…
test results
Hit ▶ Run to test your code against the visible cases.