Find Peak Element
Read at your own pace. Code execution, quizzes, progress tracking, and the AI tutor are available in the interactive view with JavaScript enabled.
Find Peak Element
A peak element is an element that is strictly greater than its neighbors.
Consider that we are given a list of numbers, such as the following:
[1, 2, 3, 1]
Determine the peak element of this list, and return its index. If the array contains multiple peaks, return the index to any of the peaks.

Constraints
- 1 <=
nums.length<= 1000 - -231 <=
nums[i]<= 231 - 1 -
nums[i] != nums[i + 1]for all validi.
CONTINUE WITH ALGODAILY PREMIUM
Keep going with the complete tutorial.
Unlock the remaining explanations and exercises, alongside the full learning library.
Explore Premium →