Question bank › Binary Search
Dsa Binary Search Easy

Search for the Peak Element

You are given an array of integers where each element is unique. A peak element is an element that is greater than its neighbors. Write a function to find any peak element in the array. If the array contains multiple peaks, return any one of them. The function should use a binary search approach to achieve O(log n) time complexity. Input: - A single line containing space-separated integers, representing the array. Output: - A single integer which is any peak element. Example: Input: 1 2 3 1 Output: 3

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