Coding · should-tier · asked at Amazon, Apple, Google, Meta, Microsoft, Netflix
Find Minimum in Rotated Sorted Array
mediumbinary-search
Problem
An array of distinct integers, originally sorted in ascending order, has been rotated by some amount between 0 and n - 1 positions. Return the smallest element in logarithmic time.
numshas between 1 and 20,000 elements, all distinct.- Values are integers between -100,000 and 100,000.
- A rotation of
0(the array is already sorted) is allowed.
Examples
nums = [8, 10, 14, 3, 5]→3. The original array[3, 5, 8, 10, 14]was rotated by 3.nums = [20, 25, 30, 1, 6, 9, 12]→1.nums = [2, 6, 7, 9]→2. No rotation; the first element is the minimum.
Hints
- The minimum is the only element smaller than its left neighbour. Scanning for it is O(n); how could you jump there?
- Compare
nums[mid]with the last element of the current window. What does each outcome tell you about where the minimum is? - Binary search: if
nums[mid] > nums[hi]the drop is to the right ofmid, otherwise it is atmidor to the left.
Last reviewed 8 September 2026
Locked
Approach · Solution (Python) · Complexity · Follow-ups · Company variations · Tests
The rest of this question — the worked approach, the Python solution with passing tests, complexity, follow-ups and how each company frames it — is part of the guides.
Get the full guide
Pick the company you're interviewing with. Each guide has every question tiered for that loop — one-time purchase, lifetime access.
Secure payment by Stripe · instant access · refund questions: [email protected]
Also in: Apple, Google, Meta, Microsoft, Netflix
Interviewing at more than one? All 6 guides for $499 · save $395
Not ready to buy? Get the free starter pack — 13 questions with full solutions.