Skip to content

Commit fffbaa9

Browse files
committed
solve : meeting rooms ii
1 parent 8d2e6dc commit fffbaa9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

meeting-rooms-ii/samthekorean.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution:
2+
def minMeetingRooms(self, intervals: List[List[int]]) -> int:
3+
pairs = []
4+
for start, end in intervals:
5+
pairs += [(start, 1), (end, -1)]
6+
pairs.sort()
7+
8+
max_cnt, cnt = 0, 0
9+
for pair in pairs:
10+
cnt += pair[1]
11+
max_cnt = max(cnt, max_cnt)
12+
return max_cnt

0 commit comments

Comments
 (0)