文章作者:Tyan 博客:noahsnail.com | CSDN | 简书
1. Description
2. Solution
代码语言:javascript复制class Solution:
def eraseOverlapIntervals(self, intervals):
count = 0
if len(intervals) < 2:
return count
intervals.sort(key=lambda interval: interval[1])
overlap = intervals[0]
for index in range(1, len(intervals)):
if overlap[1] > intervals[index][0]:
count = 1
else:
overlap = intervals[index]
return count
Reference
- https://leetcode.com/problems/non-overlapping-intervals/