programmers.co.kr/learn/courses/30/lessons/42889
def solution(N, stages):
result = []
stages=sorted(stages) # 정렬
size = len(stages) # stages의 크기=> size
tmp=0
answer=[] # 반환
for i in range(N):
tmp=stages.count(i+1)
if size==0 or tmp==0:
result.append((i+1,0))
else:
result.append((i+1,tmp/size))
size-=tmp
result.sort(key=lambda x:(-x[1]))
for i in result:
answer.append(i[0])
return answer
유튜버 동빈나님 풀이
'자기개발👨💻 > 코딩 알고리즘' 카테고리의 다른 글
[python] 백준1145 적어도 대부분의 배수 (0) | 2021.03.11 |
---|---|
[python] 백준 1032 명령프롬프트 (0) | 2021.03.10 |
[python] 프로그래머스 2019kakao 오픈채팅방 (0) | 2021.02.21 |
[python] 백준 10814 나이순 정렬 (0) | 2021.01.31 |
[python] 프로그래머스 카펫 (0) | 2021.01.07 |
[python] 프로그래머스 모의고사 (0) | 2021.01.07 |