FastPrepFind Right Interval
Problems/Find Right Interval

Find Right Interval

Bloomberg LP logoBloomberg LP● MediumNEW GRADPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Bloomberg new grad phone screen. A reply in the report names a well-known problem. That problem gives the exact rule for picking the right interval, says starts are unique, and gives the examples and limits.

You are given an array of intervals, where intervals[i] = [start_i, end_i] and every start value is unique.

For each interval i, find an interval j whose start is greater than or equal to end_i. Among all such intervals, choose the one with the smallest start.

Return an array of indices where result i is the chosen index j, or -1 when no right interval exists.

Function

findRightInterval(intervals: int[][]) → int[]

Examples

Example 1

intervals = [[1,2]]return = [-1]

No interval starts at or after 2.

Example 2

intervals = [[3,4],[2,3],[1,2]]return = [-1,0,1]

Interval 0 has no right interval. Interval 1 chooses start 3 at index 0, and interval 2 chooses start 2 at index 1.

Example 3

intervals = [[1,4],[2,3],[3,4]]return = [-1,2,-1]

Only interval 1 has a right interval: index 2 starts exactly at its end value 3.

Constraints

  • 1 <= intervals.length <= 100000.
  • Each interval contains exactly two integers [start, end] with -10^9 <= start <= end <= 10^9.
  • Every interval start value is unique.

More Bloomberg LP Phone Screen 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
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
  • Recommend Films from Viewers Who Watched Everything You DidPHONE SCREEN · Seen Nov 2026
  • Track New Values in Sorted OrderPHONE SCREEN · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Count Winning Dice Face PairsGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Aggressive CowsAmazon · PHONE SCREEN
  • Classify Heap Addresses from a Memory SnapshotSquarepoint Capital · PHONE SCREENSquarepoint Capital interview questions
  • Count Centaur Friend RequestsMeta · PHONE SCREENMeta interview questions
  • Maximize the Minimum Cone DistanceSumo Logic · PHONE SCREEN
  • Count Triples That Can Form a TriangleAdobe · PHONE SCREENAdobe interview questions
  • HTTP Log QueriesDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions
  • Find the Words for Each PrefixDocuSign · PHONE SCREENDocuSign interview questions
  • Maximize Fish over Limited HoursByteDance · PHONE SCREENByteDance interview questions
  • Count Lamps Lighting Each PointAirbnb · OAAirbnb 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[] findRightInterval(int[][] intervals) {
        // Write your code here.
    }

}
Checking account…