Question bank › Binary Search
Dsa Binary Search Easy

Finding the Peak

Given a strictly increasing and then strictly decreasing list of integers, implement a function to find the peak element (the element that is greater than its neighbors). If there are multiple peaks, return the index of any one of them. Input format: - The first line contains an integer n (3 <= n <= 10^5), the number of elements in the array. - The second line contains n space-separated integers representing the elements of the array. Output format: - Print the index of a peak element. Example: Input: 5 1 3 5 4 2 Output: 2

Key concepts

binary_searchsearchsequence

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
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.