https://programmers.co.kr/learn/courses/30/lessons/42578
Code
1. Counter
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from collections import defaultdict
def solution(clothes):
answer = 0
comb = defaultdict(list)
for val, key in clothes:
comb[key].append(val)
answer = 1
for val in comb.values():
answer *= len(val) + 1
answer -= 1
return answer
Complexity
$O(n)$
- $n$ = nrows(clothes)
PREVIOUSEtc