추석 트래픽 -pyhton(programmers)

참치돌고래·2021년 8월 30일
0

알고리즘

목록 보기
10/36
post-custom-banner

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
profile
안녕하세요
post-custom-banner

0개의 댓글