We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3214067 commit 2615f35Copy full SHA for 2615f35
non-overlapping-intervals/hu6r1s.py
@@ -0,0 +1,13 @@
1
+class Solution:
2
+ def eraseOverlapIntervals(self, intervals: List[List[int]]) -> int:
3
+ intervals.sort()
4
+ cnt = 0
5
+ pre_end = intervals[0][1]
6
+ for i in range(1, len(intervals)):
7
+ start, end = intervals[i]
8
+ if pre_end > start:
9
+ cnt += 1
10
+ pre_end = min(end, pre_end)
11
+ else:
12
+ pre_end = end
13
+ return cnt
0 commit comments