435. Non-overlapping Intervals
https://leetcode.com/problems/non-overlapping-intervals/
class Solution:
def eraseOverlapIntervals(self, intervals: List[List[int]]) -> int:
intervals.sort(key=lambda interval: interval[0])
result = 0
end = intervals[0][1]
for interval in intervals[1:]:
if interval[0] < end:
result += 1
if interval[1] < end:
end = interval[1]
else:
end = interval[1]
return result