Coding Challenge

Non-overlapping Intervals

Medium
intervalsgreedy

Remove the minimum number of intervals to eliminate overlaps.

Given intervals, return the minimum number of intervals you must remove so the remaining intervals are non-overlapping.

Examples

Input: intervals = [[1,2],[2,3],[3,4],[1,3]]

Output: 1

Constraints

  • Intervals may overlap arbitrarily

Preparing your coding workspace...