Dsa
Two Pointers
Medium
Mountain Peak
Given an array of integers that represents the heights of mountains, find the highest point (peak) in the array. A peak is defined as an element that is greater than its neighbors. Return the index of the peak. If there are multiple peaks, return the index of any one of them. The input array will always have at least three elements, and the input array is guaranteed to have at least one peak.
Example:
Input:
5 1 3 7 4 6 5
Output:
3
Key concepts
two_pointersarraybinary_search
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now