July 08, 2021
def solution(clothes):
answer = 1
_list = dict()
for cloth in clothes:
if cloth[1] in _list.keys():
_list[cloth[1]].append(cloth[0])
else:
_list[cloth[1]] = [cloth[0]]
for key in _list:
answer *= len(_list[key]) + 1
return answer - 1
def solution(clothes):
from collections import Counter
from functools import reduce
cnt = Counter([kind for name, kind in clothes])
answer = reduce(lambda x, y: x * (y + 1), cnt.values(), 1) - 1
return answer
import collections
from functools import reduce
def solution(c):
return reduce(lambda x, y: x * y,
[a + 1 for a in collections.Counter([x[1] for x in c]).values()]) - 1