143. Find Peak Element

MediumBinary Search

A peak element is an element that is strictly greater than its neighbors. Return the index of any peak element.

Examples

Input: [1,3,7,5,9,11,6,4,2]

Output: 2

Explanation: Public test case for Find Peak Element

Constraints

  • 1 <= nums.length <= 1000
  • nums[i] != nums[i + 1] for all valid i
Loading...

Run checks all cases above. Submit evaluates all test cases.