Pattern Recognition Drill
Medium Binary Search
The Problem
Given a rotated sorted array with unique elements, find the minimum element.
What approach would you use?
Think about it before scrolling down.
Compare a[mid] with a[hi]. If a[mid] > a[hi], rotation point is right. O(log n).
Common Trap
Compare with a[hi] not a[lo]. Comparing with a[lo] doesn't reliably tell you which side the min is on.