나의 답안

def solution(N, stages):
    answer = {}
    n = len(stages)
    
    for i in range(1, N + 1):
        if n != 0:
            cnt = stages.count(i)
            answer[i] = cnt / n
            n -= cnt
        else:
            answer[i] = 0

    return sorted(answer, key=lambda x: answer[x], reverse=True)

 

+ Recent posts