프로그래머스/level 2
[프로그래머스] 위장
binaryJournalist
2022. 4. 20. 20:38
반응형
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges
def solution(clothes):
categories = dict()
spi_woredrobe = dict()
answer = 1
for c in clothes:
if not c[1] in spi_woredrobe:
spi_woredrobe[c[1]] = set()
categories[c[1]] = 0
if not c[0] in spi_woredrobe[c[1]]:
spi_woredrobe[c[1]].add(c[0])
categories[c[1]] += 1
for val in categories.values():
answer *= (val + 1)
return answer - 1
반응형