Open Soohan-Kim opened 4 months ago
class Solution:
def eraseOverlapIntervals(self, intervals: List[List[int]]) -> int:
ret = 0
intervals.sort(key=lambda x:x[1])
curEnd = intervals[0][1]
for (s, e) in intervals[1:]:
if s >= curEnd:
curEnd = e
else:
ret += 1
return ret
https://leetcode.com/problems/non-overlapping-intervals/description/