코딩테스트/프로그래머스
위장
카늬
2022. 11. 18. 13:27
from functools import reduce
def solution(clothes):
answer = 0
dic = {}
for cloth in clothes:
if cloth[1] in dic:#딕셔너리에 있으면 갯수 추가
dic.update({cloth[1]:dic.get(cloth[1])+1})
else:#딕셔너리에 없으면 추가
dic[cloth[1]] = 2
li = list(dic.values())
answer = reduce(lambda x, y: x * y, li)-1
print(answer)
return answer