Dodomeki
Sign in

37. Non-overlapping Intervals

Easy

You are given intervals. Determine the minimum number of intervals that must be removed so that the remaining ones do not share any interior points. Touching endpoints is allowed. Return only that count.

Example 1
Input: intervalos = [[1, 4], [2, 3], [3, 5]]
Output: 1
Example 2
Input: intervalos = [[1, 2], [2, 3]]
Output: 1
Explanation: The intervals touch at the endpoint, but do not share any interior points.
Constraints
  • 0 <= intervalos.length <= 10^4
  • -10^9 <= início <= fim <= 10^9
IntervalsGreedySorting
Caso 1
intervalos =
[[1,4],[2,3],[3,5]]
Expected =
1
Caso 2
intervalos =
[[1,2],[2,3]]
Expected =
0

Run checks these 2 cases. Submit runs all 6, including hidden ones.