Problem
Return the **minimum number of intervals to remove** so that the rest do not overlap. Intervals that only touch, like [1, 2] and [2, 3], do not overlap.
Example 1
- Input
- [[1, 2], [2, 3], [3, 4], [1, 3]]
- Output
- 1
- Why
- remove [1, 3]
Example 2
- Input
- [[1, 2], [1, 2], [1, 2]]
- Output
- 2
Example 3
- Input
- [[1, 2], [2, 3]]
- Output
- 0
Constraints
0 <= intervals.length <= 10^5-5 * 10^4 <= start < end <= 5 * 10^4