Dsa
Binary Search
Easy
Finding the Peak Element
Given a list of distinct integers, find any peak element. A peak element is an element that is greater than or equal to its neighbors. The input will first specify an integer n, followed by n distinct integers representing the array elements.
Input format:
- The first line contains a single integer n (1 ≤ n ≤ 1000).
- The second line contains n distinct integers.
Output format:
- Print the peak element.
Example:
Input:
5
1 2 3 4 5
Output:
5
Key concepts
binary_searcharraypeak_element
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