Pattern Recognition Drill
Medium Binary Search
The Problem
Given an array where no two adjacent elements are equal, find any peak element.
What approach would you use?
Think about it before scrolling down.
Compare mid with mid+1. Move toward the larger side — a peak is guaranteed there. O(log n).
Common Trap
Linear scan finding max is O(n). Binary search works because you can always move toward a guaranteed peak.