파이썬 알고리즘 : 의상

해시

2024년 4월 15일 알고리즘 문제풀이

문제

난이도

Lv. 2

코드

1
2
3
4
5
6
7
8
9
10
11
12
13
14
def solution(clothes):
    answer = 0
    arr = dict()
    for x in clothes:
        [n,t] = x
        if t in arr:
            arr[t] += 1
        else:
            arr[t] = 1
    cnt = 1
    for a,b in arr.items():
        cnt *= (b+1)
    answer = cnt-1
    return answer