티스토리 뷰

https://programmers.co.kr/learn/courses/30/lessons/42578

 

코딩테스트 연습 - 위장

 

programmers.co.kr

def solution(clothes):
    answer = 1
    clothe = {}
    
    for i in range(len(clothes)):
        if clothes[i][1] not in clothe:
            clothe[clothes[i][1]] = 1
        else:
            tmp = clothe[clothes[i][1]]
            tmp += 1
            clothe[clothes[i][1]] = tmp
            
    for c in clothe:
        answer *= (clothe[c] + 1)
        
    answer -= 1
    
    return answer

 

공지사항
최근에 올라온 글
«   2024/11   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
글 보관함