Skip to content

Commit f02248b

Browse files
author
hangyeol
committed
92차 3번 문제풀이
1 parent 2e66950 commit f02248b

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

live9/test92/문제3/백한결.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
def solution(book_time):
2+
books = []
3+
4+
for start, end in book_time:
5+
books.append((hour_to_minutes(start), 1))
6+
books.append((hour_to_minutes(end) + 10, -1))
7+
8+
books.sort()
9+
10+
current_rooms = 0
11+
needed_rooms = 0
12+
13+
for time, type in books:
14+
current_rooms += type
15+
needed_rooms = max(needed_rooms, current_rooms)
16+
17+
return needed_rooms
18+
19+
20+
def hour_to_minutes(time):
21+
hour, minute = map(int, time.split(":"))
22+
return hour * 60 + minute

0 commit comments

Comments
 (0)