FastPrepFind in Mountain Array
Problems/Find in Mountain Array

Find in Mountain Array

Bloomberg LP logoBloomberg LP● HardNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Bloomberg new grad onsite interview, in the first round. The report corrects its first problem choice, and says the interviewer asked for the binary search that finds the peak before moving on. Our version keeps the whole standard mountain-array search, with a plain integer array as input.

A mountain array strictly increases to one peak and then strictly decreases.

Given a mountain array mountain and an integer target, return the smallest index whose value equals target. Return -1 when the target is absent.

Your algorithm must use logarithmic-time binary searches rather than scanning the array.

Function

findInMountainArray(mountain: int[], target: int) → int

Examples

Example 1

mountain = [1,2,3,4,5,3,1]target = 3return = 2

Value 3 appears on both slopes; return its smaller index 2.

Example 2

mountain = [0,1,2,4,2,1]target = 3return = -1

The target is absent.

Example 3

mountain = [1,5,2]target = 5return = 1

The target is the peak.

Constraints

  • 3 <= mountain.length <= 100000.
  • -10^9 <= mountain[i], target <= 10^9.
  • There is exactly one peak, with at least one value on each side.
  • The left slope is strictly increasing and the right slope is strictly decreasing.

More Bloomberg LP Onsite Interview questions

  • Pascal's TrianglePHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Valid Triangle NumberPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Top K Frequent WordsONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Shortest Subarray with Sum at Least KOracle · ONSITE INTERVIEWOracle interview questions
  • Russian Doll EnvelopesGoogle · ONSITE INTERVIEWGoogle interview questions
  • K-th Element of Two Sorted ArraysFlipkart · ONSITE INTERVIEW
  • Allocate Minimum PagesAmazon · ONSITE INTERVIEW
  • Minimum Processing Speed with Multiple RidersDoorDash · ONSITE INTERVIEWDoorDash interview questions
  • Russian Doll EnvelopesInMobi · ONSITE INTERVIEWInMobi interview questions
  • Median of Two Sorted ArraysRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions
  • Median of Two Sorted ArraysMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Russian Doll EnvelopesAirbnb · ONSITE INTERVIEWAirbnb interview questions
  • Median of Two Sorted ArraysExpedia · ONSITE INTERVIEWExpedia interview questions

Bloomberg LP interview experiences

  • Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
  • Bloomberg SWE Intern Interview Questions: 68 Questions
  • Bloomberg Interview Questions, Level Not Reported: 65 Questions
  • Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
  • Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
  • Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public int findInMountainArray(int[] mountain, int target) {
        // Write your code here.
    }

}
Checking account…