Coding Test

프로그래머스: 코딩테스트 연습 - 해시 - 위장

일시불

문제

https://programmers.co.kr/learn/courses/30/lessons/42578

정답

from collections import defaultdict


def solution(clothes):
    comb = defaultdict(list)

    for cloth, category in clothes:
        comb[category].append(cloth)

    result = 1
    for category in comb.keys():
        result *= len(comb[category]) + 1

    return result - 1