https://programmers.co.kr/learn/courses/30/lessons/42576
ํ์ด
# # ํ๋ก๊ทธ๋๋จธ์ค 1๋จ๊ณ - ์์ฃผํ์ง ๋ชปํ ์ ์
def solution(participant, completion):
participant.sort()
completion.sort()
for p, c in zip(participant, completion):
if p != c: # ์ ๋ ฌ ํ์ ๋ participant์ completion์ด ๋ค๋ฅผ ๊ฒฝ์ฐ
return p
return participant.pop()
import collections
def solution(participant, completion):
answer = collections.Counter(participant) - collections.Counter(completion)
return list(answer.keys())[0]
collections ์ Counter ๋ฅผ ์ฌ์ฉํ์ฌ ๋ฌธ์ ๋ฃฐ ํด๊ฒฐ์ด ๊ฐ๋ฅํ์๋ค.