Skip to content

Commit ccd211f

Browse files
authored
Create remove-interval.py
1 parent 2be9731 commit ccd211f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Python/remove-interval.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Time: O(n)
2+
# Space: O(1)
3+
4+
class Solution(object):
5+
def removeInterval(self, intervals, toBeRemoved):
6+
"""
7+
:type intervals: List[List[int]]
8+
:type toBeRemoved: List[int]
9+
:rtype: List[List[int]]
10+
"""
11+
A, B = toBeRemoved
12+
return [[x, y] for a, b in intervals
13+
for x, y in ((a, min(A, b)), (max(a, B), b))
14+
if x < y]

0 commit comments

Comments
 (0)