Description
Given an array of intervals where intervals[i] = [start, end], return the minimum number of intervals you need to remove to make the rest non-overlapping.
Examples
Input:
intervals = [[1,2],[2,3],[3,4],[1,3]]Output:
1Explanation:
Remove [1,3] to make the rest non-overlapping.
Input:
intervals = [[1,2],[1,2],[1,2]]Output:
2Explanation:
Remove two [1,2] intervals.
Input:
intervals = [[1,2],[2,3]]Output:
0Explanation:
Edge case returning zero.
Constraints
- •
1 ≤ intervals.length ≤ 10⁵ - •
intervals[i].length == 2