chyam

[프로그래머스 Lv2, python] - 요격 시스템 본문

프로그래머스/LV2

[프로그래머스 Lv2, python] - 요격 시스템

chyam_eun 2025. 6. 24. 14:58

def solution(targets):
    answer = 0
    crit = -1 # 기준 
    targets.sort(key=lambda x:x[1]) 
    for s,e in targets:
        if crit < s: # 시작점이 기준점보다 뒤일때
            answer += 1
            crit = e - 0.5
    return answer