STUDY/Algorithm

[프로그래머스] LEVEL2 위장, python3, 해시

sinawi95 2019. 11. 18. 11:03
728x90

def solution(clothes):
    answer = 1
    tmp={}
    for cloth in clothes:
        if cloth[1] in tmp:
            tmp[cloth[1]]+=1
        else:
            tmp[cloth[1]]=1
    
    for k in tmp.values():
        answer*=k+1
    
    return answer-1