트랙픽량 산출
https://programmers.co.kr/learn/courses/30/lessons/17676
Tip.
1. 윈도우 형식으로 풀지 말 것
import datetime
def solution(lines):
#1
time = []
for line in lines:
date, end, duration = line.split(" ")
end = datetime.datetime.strptime(date+" "+end,"%Y-%m-%d %H:%M:%S.%f")
duration = float(duration.split("s")[0])
start = end - datetime.timedelta(seconds = duration - 0.001)
time.append([start,end,duration])
#2
time = sorted(time)
answer, proceeding = 1, [time[0]]
for new in time[1:]:
case = 1
if proceeding:
#3
for pcd in proceeding:
#3-1
if pcd[1] > new[0] - datetime.timedelta(seconds = 1):
case += 1
#3-2
else:
proceeding.remove(pcd)
answer = max(answer,case)
#4
proceeding.append(new)
return answer