프로그래머스 해시 완주하지 못한 선수 파이썬 풀이

minan·2021년 6월 20일
0

프로그래머스

목록 보기
7/92

문제 링크 https://programmers.co.kr/learn/courses/30/lessons/42576

프로그래머스 해시 Level 1 완주하지 못한 선수 파이썬 풀이

나는 defaultdic으로 풀었는데 엄청난 풀이가 많으니 검색해보시길

import collections

def solution(participant, completion):
   answer = ''
   
   dic = collections.defaultdict(int)
   
   for name in participant:
       dic[name] -= 1
   
   for name in completion:
       dic[name] += 1
       
   
   for key, value in dic.items():
       if value == -1:
           return key
profile
https://github.com/minhaaan

0개의 댓글