[파이썬🐍] 프로그래머스 : 베스트앨범
def solution(genres, plays): answer = [] playDic = {} dic = {} for i in range(len(genres)): playDic[genres[i]] = playDic.get(genres[i], 0) + plays[i] dic[genres[i]] = dic.get(genres[i], []) + [(plays[i], i)] genreSort = sorted(playDic.items(), key = lambda x: x[1], reverse = True) for (genre, totalPlay) in genreSort: dic[genre] = sorted(dic[genre], key = lambda x: (-x[0], x[1])) #내림차순, 오름차순 answ..
2021. 6. 24.