Minimum Removals for Non-Overlapping Intervals
Updated
Problem statement
You are given a collection of integer intervals intervals, where each interval is represented as [start, end].
Remove the minimum number of intervals so that every pair of remaining intervals is non-overlapping. When one interval ends exactly where another begins, they are compatible and may both remain.
Return the minimum number of intervals that must be removed.
Function
minimumIntervalRemovals(intervals: int[][]) → intExamples
Example 1
intervals = [[1,2],[2,3],[3,4],[1,3]]return = 1Removing [1,3] leaves three pairwise non-overlapping intervals. The intervals [1,2] and [2,3] may both remain because endpoint contact is allowed.
Example 2
intervals = [[1,2],[1,2],[1,2]]return = 2At most one of the three identical intervals can remain, so two removals are necessary.
Example 3
intervals = [[-5,-2],[-2,0],[0,1]]return = 0Every neighboring pair only touches at an endpoint, so all three intervals may remain.
Constraints
0 <= intervals.length <= 100000.- Every interval has exactly two signed 32-bit integer endpoints
[start, end]withstart < end.
More Bloomberg LP Onsite Interview questions
- 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
- Decode StringPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Minimum Replacements to Make Two Strings AnagramsPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
Similar questions at other companies
- Minimum Removals for Non-Overlapping IntervalsByteDance · PHONE SCREEN · ONSITE INTERVIEWByteDance interview questions
- Minimum Workers with Job AssignmentsLyft · ONSITE INTERVIEWLyft interview questions
- Maximum Compatible Time WindowsIBM · OAIBM 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
- Minimum Machines for TasksExpedia · OAExpedia interview questions
- Minimum Meeting RoomsSentry · PHONE SCREENSentry interview questions
- Most Disjoint Intervals From Starts and DurationsDocuSign · OADocuSign interview questions
- University Career FairRoblox · OARoblox 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)