MEDIUMasked at 6 companies

Peak Index in a Mountain Array

A medium-tier problem at 68% community acceptance, tagged with Array, Binary Search. Reported in interviews at ByteDance and 5 others.

Founder's read

Peak Index in a Mountain Array shows up at ByteDance, Google, Bloomberg, and others. The problem looks simple on the surface: find the peak of an array that increases then decreases. Most candidates reach for linear scan and pass. But the real test is whether you see the binary search pattern hidden inside. This isn't hard, but missing it signals you don't recognize when to apply Binary Search in non-traditional scenarios. That's the gap the assessment is checking. If you blank on the trick during your live OA, StealthCoder surfaces the solution in seconds, invisible to the proctor.

Companies asking
6
Difficulty
MEDIUM
Acceptance
68%

Companies that ask "Peak Index in a Mountain Array"

If this hits your live OA

Peak Index in a Mountain Array is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too.

Get StealthCoder
What this means

The mountain array always has a peak, so you can't just check if elements are strictly increasing. Linear search works but screams O(n) and wastes the constraint that the array is bimodal. The insight: use binary search to narrow down the peak side. Compare mid with mid+1. If mid is less than mid+1, the peak is to the right; otherwise it's to the left or at mid. Shrink the search space by half each iteration, landing O(log n). Candidates often overthink this with pointer edge cases or assume they need to find where the array 'turns'. They don't. Binary Search + the two-element comparison is the pattern. When this hits your assessment and time pressure kicks in, StealthCoder runs invisibly and delivers the working approach.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Peak Index in a Mountain Array recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Peak Index in a Mountain Array interview FAQ

Is this problem really asked at FAANG or just mid-market companies?+

Google and Bloomberg are in the confirmed list, plus ByteDance. It's not the hardest FAANG problem but it tests whether you recognize Binary Search patterns outside the classic 'search a sorted array' frame. That's why it stays in rotation.

What's the trick most candidates miss?+

They jump to linear iteration or nested loops checking 'is this bigger than both neighbors'. The trick is noticing the bimodal shape lets you binary search. Compare mid to mid+1 and eliminate half the array per step. Binary Search in disguise.

Does it matter which side I search when I find mid less than mid+1?+

Yes. If mid is less than mid+1, the peak is always to the right (including mid+1). If mid is greater than or equal to mid+1, the peak is at mid or to the left. Get this direction wrong and your loop won't converge cleanly.

How does this relate to broader Binary Search mastery?+

This tests whether you can spot Binary Search when the array isn't explicitly sorted for a target value. Many candidates can find an element in a sorted array but freeze when the problem doesn't scream 'use binary search'. Peak Index forces that shift in thinking.

Will I see this problem more at certain company types?+

It appears across tech (Google, ByteDance, Bloomberg) and services firms (Accenture, TCS, DE Shaw). It's a solid mid-level bar question. If your target company is in the confirmed list, practice it specifically.

Want the actual problem statement? View "Peak Index in a Mountain Array" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.