KAKAO 기출문제 LV1. 실패율

kiki·2022년 3월 3일
0

PS

목록 보기
6/7

2019 KAKAO BLIND RECRUITMENT

def solution(N, stages):
    answer = []
    people = len(stages)
    rate = dict()
    for i in range(1, N + 1):
        rate[i] = 0
        if people != 0:
            rate[i] = stages.count(i) / people
            people -= stages.count(i)

    answer = list(map(lambda x: x[0], reversed(sorted(rate.items(), key=lambda x: (x[1], -x[0])))))

    return answer

neo = 5
apeach = [2, 1, 2, 6, 2, 4, 3, 3]
frodo = solution(neo, apeach)
print(frodo)
profile
키키최고

0개의 댓글