Medium · Binary Search
Find Peak Element
Given an integer array nums in which adjacent values differ, return the index of any peak: an element strictly greater than its neighbors, where positions outside the array count as −∞.
Examples
Example 1
[1,2,1,3,5,6,4]Output: index 5 (value 6)
Example 2
[1,2,3,1]Output: index 2 (value 3)
Rebuild it in the studio
Open every published interview problem, solution, scene, and memory room free, with no account.