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 aae3ae1 commit 28a5579Copy full SHA for 28a5579
non-overlapping-intervals/printjin-gmailcom.py
@@ -0,0 +1,13 @@
1
+from typing import List
2
+
3
+class Solution:
4
+ def eraseOverlapIntervals(self, intervals: List[List[int]]) -> int:
5
+ intervals.sort(key=lambda x: x[1])
6
+ count = 0
7
+ end = float('-inf')
8
+ for start, finish in intervals:
9
+ if start < end:
10
+ count += 1
11
+ else:
12
+ end = finish
13
+ return count
0 commit comments