[프로그래머스] 위장
https://programmers.co.kr/learn/courses/30/lessons/42578
풀이
cloth 종류에 대한 경우의 수를 계산해야하는 문제이다. cloth의 종류는 clothes 리스트 요소들의 1번째 인자에 저장돼있기 때문에 해당 인자들을 기준으로 key를 만들어준다.
from collections import defaultdict
def solution(clothes):
answer = defaultdict(int)
for cloth in clothes:
answer[cloth[1]] += 1
cnt