We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9f63f9c commit 1cdfc45Copy full SHA for 1cdfc45
1 file changed
live9/test94/문제2/박희경.py
@@ -0,0 +1,19 @@
1
+import heapq
2
+
3
+def time_to_minute(time):
4
+ h, m = map(int, time.split(':'))
5
+ return h * 60 + m
6
7
+def solution(book_time):
8
9
+ book = sorted([[time_to_minute(start), time_to_minute(end) + 10] for start, end in book_time])
10
11
+ room = []
12
+ for start, end in book:
13
+ if room:
14
+ early_end = room[0] # 가장 빠른 퇴실 시간
15
+ if start >= early_end: # 입실 시간이 가장 빠른 퇴실 시간 이후라면 갱신
16
+ heapq.heappop(room)
17
+ heapq.heappush(room, end)
18
19
+ return len(room)
0 commit comments