Remove Intervals to Avoid Overlap
ARRAY
DYNAMIC PROGRAMMING
Problem
Given an array of intervals
and returns the minimum number of intervals to remove in order to eliminate all overlapping intervals.
Each interval is represented by a start and end time.
Examples
minIntervalRemovals([[1, 3], [2, 4], [3, 5]]) // return 1 // Why? We can remove interval [2, 4] minIntervalRemovals([[1, 10], [2, 6], [3, 8], [5, 7]]) // return 3 // Why? All intervals overlap with [1, 10]
Loading...
Loading...Loading...