https://school.programmers.co.kr/learn/courses/30/lessons/42576
# sort 이용
def solution(participant, completion):
answer = 0
participant.sort()
completion.sort()
for i,j in zip(participant,completion):
if i != j:
break
answer +=1
return (participant[answer])
# 해시 이용
from collections import defaultdict
def solution(participant, completion):
answer = 0
tmp_dic = defaultdict(int)
# 참가자 이름을 키값으로 동명이인 포함하여 인원 수를 value값으로 dict에 저장
for i in participant:
tmp_dic[i] += 1
# 완주자 이름을 키값으로 찾아서 value를 1을 뺀다.
# (단, value값이 0이 되면 동명이인이 없는 것이므로 tmp_dic에서 제거)
for i in completion:
tmp_dic[i] -= 1
if tmp_dic[i] == 0:
del tmp_dic[i]
return list(tmp_dic)[0]
[defaultdict 라이브러리]
https://velog.io/@jsanga214/%EB%94%95%EC%85%94%EB%84%88%EB%A6%AC-%ED%95%B4%EA%B2%B0-%EB%B0%A9%EC%95%88
Now i'm actually very happy to locate this web site and also would take pleasure in studying beneficial posts published the following. The particular tips with the creator has been great, thank you for your discuss. https://gatesofolympus2slot.com