Find Minimum in Rotated Sorted Array
Module 13 · Binary Search
Problem
A sorted array (distinct values) has been rotated at an unknown pivot. Return the minimum element, in O(log n).
Examples
Example 1
Input
nums = [3,4,5,1,2]Output1Example 2
Input
nums = [4,5,6,7,0,1,2]Output0Example 3
Input
nums = [11,13,15,17]Output11Explanation. not rotated at all — pivot = 0
Constraints
1 ≤ n ≤ 5000 · distinct values.
Attempt it first
The module's capstone: it's the boundary-search template (lesson 2) applied to Search in Rotated Sorted Array's "one sorted half" insight (the previous problem). Define the right monotonic predicate over positions and this becomes a single clean binary search — no target to compare against, just structure.