Non-overlapping Intervals

Given an array of intervals where each interval is defined by a start and end point, this problem asks you to determine the minimum number of intervals that need to be removed to ensure that the remaining intervals do not overlap. Intervals that only touch at one point are considered non-overlapping.

Constraints

  • 1 <= intervals.length <= 10^5
  • intervals[i].length == 2
  • -5 * 10^4 <= start_i < end_i <= 5 * 10^4
Saving… · 2 lines
class Solution:
def erase_overlap_intervals(self, intervals: List[List[int]]) -> int:
Console

Click Run to execute sample tests.