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 999bb5b commit fe62c16Copy full SHA for fe62c16
python/2402-meeting-rooms-iii.py
@@ -0,0 +1,23 @@
1
+class Solution:
2
+ def mostBooked(self, n: int, meetings: List[List[int]]) -> int:
3
+ meetings.sort()
4
+
5
+ available = [i for i in range(n)]
6
+ used = []
7
+ count = [0] * n
8
9
+ for start, end in meetings:
10
+ while used and start >= used[0][0]:
11
+ _, room = heapq.heappop(used)
12
+ heapq.heappush(available, room)
13
14
+ if not available:
15
+ end_time, room = heapq.heappop(used)
16
+ end = end_time + (end - start)
17
18
19
+ room = heapq.heappop(available)
20
+ heapq.heappush(used, (end, room))
21
+ count[room] += 1
22
23
+ return count.index(max(count))
0 commit comments