프로그래머스 - 추석 트래픽


프로그래머스 - 추석 트래픽

1234567891011121314151617181920212223242526def solution(lines): times = [] for l in lines: tmp = l.split() end = tmp[1].split(":") process = float(tmp[2][:-1]) * 1000 end = int(end[0]) * 3600000 + int(end[1]) * 60000 + \ float(end[2]) * 1000 start = end - process + 1 times.append((start,end)) answer = 0 for time in times: fr = [time[0], time[1]] to = [time[0] + 999, time[1] + 999] cnt = 0 cnt2 = 0 for t in times: if t[0] <= to[0] and t[1] >= fr[0]: cnt += 1 if t[0] <= to[1] and t[1] >= fr[1]: cnt2 += 1 answer = max(answer,cnt,cnt2) return answerColored by Color Scriptercs 시간을 mi..........



원문링크 : 프로그래머스 - 추석 트래픽