Given an array of intervals, 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: 1
Input: intervals = [[1,2],[1,2],[1,2]] Output: 2
Input: intervals = [[1,2],[2,3]] Output: 0
Constraints
- 1 <= intervals.length <= 100,000
- intervals[i].length == 2
- -50,000 <= start < end <= 50,000