본문 바로가기
Programmers

[python] 위장

by DylanMsK 2019. 9. 6.

문제 출처

위장

 

풀이


def solution(clothes):
    answer = 1
    comb = {}
    for name, cat in clothes:
        if comb.get(cat):
            comb[cat].append(name)
        else:
            comb[cat] = [name]
    for cat in comb:
        answer *= len(comb[cat])+1
    return answer-1
    

'Programmers' 카테고리의 다른 글

[python] 체육복  (0) 2019.09.06
[python] 베스트앨범  (0) 2019.09.06
[python] 전화번호 목록  (0) 2019.09.03
[python] 완주하지 못한 선수  (0) 2019.09.03
[python] 추석 트래픽  (0) 2019.09.03