Algorithm/Programmers

[프로그래머스/Python] 의상

빵빵0 2023. 9. 12. 23:56

백준 '9375번, 패션왕 신해빈' 문제와 완전 똑같기 때문에 풀이도 똑같다.

해당 문제 풀이는 여기 참고!

 

def solution(clothes):
    closet = {}
    for cloth, type in clothes:
        if type not in closet:
            closet[type] = 1
        closet[type] += 1
    
    answer = 1
    for k, v in closet.items():
        answer *= v
    return answer - 1