로그 데이터의 초당 최대 처리량을 계산하는 문제이다.
다음의 과정을 거쳐 문제를 해결하였다.
from collections import defaultdict
def solution(lines):
count = defaultdict(int)
for line in lines:
_, t, interval = line.split()
h, m, s = t.split(":")
end_time = int(float(h) * 60 * 60 * 1000 + float(m) * 60 * 1000 + float(s) * 1000)
interval = int(float(interval[:-1]) * 1000)
for t in range(end_time-interval+1, end_time+1):
count[t] += 1
for t in range(end_time+1, end_time+1000):
count[t] += 1
return max(count.values())