목록실패율 (1)
컴공생의 다이어리
[프로그래머스] 실패율 - 파이썬(Python)
[프로그래머스] 실패율 - 파이썬(Python) import collections def solution(N, stages): total_people = len(stages) stage_count = dict(collections.Counter(stages)) result = [] for i in range(1, N + 1): if i in stage_count.keys(): result.append((i, stage_count[i] / total_people)) total_people -= stage_count[i] else: result.append((i, 0)) result.sort(key=lambda x: (-x[1], x[0])) return [x for x, _ in result] https:..
Development/Algorithm & Coding Test
2022. 6. 12. 00:01