https://programmers.co.kr/learn/courses/30/lessons/17676
def solution(lines):
answer = 0
stack = []
for line in lines:
duration = round(float(line[24:-1]),6)
end = round(float(line[11:13]) * 60 *60 + float(line[14:16])*60 + float(line[17:23]),6)
start = round(end - duration + 0.001 ,6)
stack.append([start,end])
stack.sort()
print(stack)
for s,e in stack:
answer = max(answer, counting(stack, s, s + 1), counting(stack, e, e + 1))
return answer
def counting(stack, start, end):
cnt = 0
for s,e in stack:
if s < end and e >= start:
cnt += 1
return cnt