20%off off — LaunchSpecial
Exercises/#66 Find Peak Element
#66

Find Peak Element

Medium🔍 Sorting & Searching
70 XP

Problem

A peak element is greater than its neighbors. Given an array, find a peak element's index in O(log n) time.

Examples

Input: nums=[1,2,3,1]
Output: 2 (nums[2]=3 is a peak)

Input: nums=[1,2,1,3,5,6,4]
Output: 5
binary-searchdivide-conquer
AI Assistant— powered by AI

Unlock hints progressively — start gentle, go deeper only if needed.

💡

Level 1: Gentle Nudge

A subtle direction

🗺️

Level 2: Approach

The algorithm to use

🔍

Level 3: Detailed

Step-by-step guidance

66 / 150

Your Solution

⚡ JavaScript

to save progress and use AI features