L1 : 실패율 Python

jhyunn·2023년 1월 23일
0

Programmers

목록 보기
61/69

L1 : 실패율 Python

https://school.programmers.co.kr/learn/courses/30/lessons/42889

def solution(N, stages):
    answer = []
    counting = 0
    stages.sort()
    
    for i in range(1, N+1):
        if max(stages) < i:
            answer.append([i, 0])
            continue
            
        not_clear = stages.count(i)
        arrived = len(stages) - counting
        counting += not_clear
        answer.append([i, not_clear/arrived])
    
    answer.sort(key=lambda x:x[1], reverse=True)
    return [x[0] for x in answer]
profile
https://github.com/Sungjeonghyun

0개의 댓글