Minimum of a Shifted List
Medium · Minimum of a Shifted List
There was a list of `n` distinct integers sorted in ascending order. It was cyclically shifted to the right between 1 and `n` times; one shift moves the last element to the front. For example, `[2, 5, 8, 11]` turns into `[8, 11, 2, 5]` after two shifts, and back into `[2, 5, 8, 11]` after four. You are given the resulting list `ring`. Return its smallest element. Your algorithm should run in O(log n) time.…
Solve the problem →