문제링크 : https://school.programmers.co.kr/learn/courses/30/lessons/155651
import heapq
def solution(book_time):
book = []
h = []
for s,e in book_time:
book.append([int(s.split(':')[0]) * 60 + int(s.split(':')[1]),
int(e.split(':')[0]) * 60 + int(e.split(':')[1]) + 10])
book.sort(key=lambda x:x[0])
maxVal = 0
for i in book:
while h:
if h[0] <= i[0]: #만약 퇴실 시간이 입실시간 보다 빠르면 방을 비운다.
heapq.heappop(h)
else:
break
heapq.heappush(h, i[1])
maxVal = max(len(h), maxVal)
return maxVal