FastPrepMaximum Non-Overlapping Longer Intervals
Problems/Maximum Non-Overlapping Longer Intervals

Maximum Non-Overlapping Longer Intervals

Bloomberg LP logoBloomberg LP● MediumNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a firsthand Bloomberg new-grad onsite interview. The report says longer intervals have priority. We turned that into a rule: sort by length from long to short, with a fixed tie rule.

Treat intervals as half-open [start,end). Consider them by descending length, breaking ties by ascending start then end. Accept an interval when it does not overlap any already accepted interval.

Return the resulting maximal accepted set sorted by start then end.

Function

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

Examples

Example 1

intervals = [[0,10],[0,4],[4,8],[10,12]]return = [[0,10],[10,12]]

The length-ten interval is accepted first and blocks both shorter contained intervals.

Constraints

  • 0 <= intervals.length <= 2000.
  • start < end.

More Bloomberg LP Onsite Interview questions

  • 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
  • Word SearchOA · PHONE 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
  • Decode StringPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Minimum Replacements to Make Two Strings AnagramsPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • Currency Conversion RatePHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026

Similar questions at other companies

  • Minimum Railway PlatformsMakeMyTrip.com · ONSITE INTERVIEWMakeMyTrip.com interview questions
  • Maximum Non-Overlapping IntervalsMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Minimum Removals for Non-Overlapping IntervalsByteDance · PHONE SCREEN · ONSITE INTERVIEWByteDance interview questions
  • Minimum Workers with Job AssignmentsLyft · ONSITE INTERVIEWLyft interview questions
  • Minimum Points Hitting Every Closed IntervalGoogle · ONSITE INTERVIEWGoogle interview questions
  • Maximum Compatible Time WindowsIBM · OAIBM interview questions
  • Task SchedulingJP Morgan Chase · OAJP Morgan Chase interview questions
  • Maximum Number of Events That Can Be AttendedSnowflake · PHONE SCREENSnowflake interview questions
  • Minimum Appointment Cancellations with a Required BreakMaven Clinic · PHONE SCREENMaven Clinic interview questions
  • Minimum Markers to Clear Line SegmentsHSBC · OAHSBC 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[][] prioritizeLongerIntervals(int[][] intervals) {
      // Write your code here.
    }
}
Checking account…