As reported: Expedia SDE-2 round 2 DSA (Bangalore, 2025): Find Minimum in Rotated Sorted Array — binary search, its invariants, and how duplicates change it.
A sorted array was rotated at an unknown pivot (e.g. [0,1,4,4,5,6,7] → [4,5,6,7,0,1,4]). Return its minimum value. Values may repeat.
Without duplicates this is LeetCode 153 — Find Minimum in Rotated Sorted Array; with duplicates it is LeetCode 154, which the runner uses.
Example
[3,4,5,1,2] -> 1
[1,3,5] -> 1
[2,2,2,0,1] -> 0
Constraints: 1 ≤ n ≤ 5000; -5000 ≤ nums[i] ≤ 5000; sorted then rotated 1 to n times.
Code runner format: one line with nums. Implement findMin(nums); the harness prints the minimum.