def solution(clothes):
temp = {}
for i in clothes:
print(i)
if temp.get(i[1]):
hoho = temp.get(i[1])
hoho.append(i[0])
temp[i[1]] = hoho
else:
temp[i[1]] = [i[0],]
print(temp)
nums = []
for i in temp:
nums.append(len(temp[i]))
print(nums)
hoho =1
for i in nums:
hoho *= (i+1)
hoho -= 1
return hoho
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
def solution(clothes):
clothes_type = {}
for c, t in clothes:
if t not in clothes_type:
clothes_type[t] = 2
else:
clothes_type[t] += 1
cnt = 1
for num in clothes_type.values():
cnt *= num
return cnt - 1
def solution(clothes):
cl_dict = dict()
for _ , categori in clothes:
if categori in cl_dict:
cl_dict[categori] += 1
else:
cl_dict[categori] = 2
answer = 1
for cate in cl_dict:
answer *= cl_dict[cate]
return answer - 1
def solution(clothes):
answer = 1
d = {}
for e in clothes:
d[e[-1]] = (len(e)-1) if e[-1] not in d else d[e[-1]] + (len(e)-1)
for e in list(d.values()):
answer *= (e+1)
return answer-1
def solution(clothes):
answer = 1
aDict = {}
for i in clothes:
if i[1] in aDict:
aDict[i[1]] += 1
else:
aDict[i[1]] = 1
for i in aDict.keys():
answer *= aDict[i] +1
answer -= 1
return answer
def solution(clothes):
d = {}
for v in clothes:
if not v[1] in d:
d[v[1]] = 1
else:
d[v[1]] += 1
d = list(d.values())
ans = 1
for i in d:
ans *= i+1
return ans - 1
def solution(clothes):
answer = {}
for v,k in clothes:
try:
answer[k] += 1
except KeyError:
answer[k] = 2
result = 1
for i in answer.values():
result *= i
return result -1
from functools import reduce
from operator import mul
def solution(clothes):
cDict = dict()
for c in clothes:
try:
cDict[c[1]] += 1
except:
cDict[c[1]] = 2
return reduce(mul, cDict.values()) - 1