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 82ed731 commit a84de66Copy full SHA for a84de66
1 file changed
non-overlapping-intervals/8804who.py
@@ -0,0 +1,13 @@
1
+class Solution:
2
+ def eraseOverlapIntervals(self, intervals: List[List[int]]) -> int:
3
+ answer, end = 0, -inf
4
+ intervals.sort(key = lambda x:x[1])
5
+
6
+ for i_s, i_e in intervals:
7
+ if end <= i_s:
8
+ end = i_e
9
+ else:
10
+ answer += 1
11
12
+ return answer
13
0 commit comments