Dictionary1 [프로그래머스] [Python] Level2_위장 https://programmers.co.kr/learn/courses/30/lessons/42578 코딩테스트 연습 - 위장 programmers.co.kr 풀이 유형 : 해시 Hash 1차 시도 def solution(clothes): dic = {} answer = 1 for cloth in clothes: dic[cloth[1]] = dic.get(cloth[1], []) + [cloth[0]] for i in dic: answer *= len(dic[i])+1 return answer-1 💡 최종 로직 0. 주어진 clothes를 사용하여 dictionary를 만든다 1. dic를 순회하며 (각 value의 갯수 +1)을 answer에 곱한다 +1을 하는 이유 : 각 의상 타입에 "안입음"이라는.. 2021. 8. 2. 이전 1 다음