https://school.programmers.co.kr/learn/courses/30/lessons/42576
ํ๋ก๊ทธ๋๋จธ์ค
SW๊ฐ๋ฐ์๋ฅผ ์ํ ํ๊ฐ, ๊ต์ก์ Total Solution์ ์ ๊ณตํ๋ ๊ฐ๋ฐ์ ์ฑ์ฅ์ ์ํ ๋ฒ ์ด์ค์บ ํ
programmers.co.kr
def solution(participant, completion):
part = {}
for p in participant:
if p not in part:
part[p] = 1
else:
part[p] += 1
comp = {}
for c in completion:
if c not in comp:
comp[c] = 1
else:
comp[c] += 1
for key, value in part.items():
if key not in comp: # participant์ ์๋ ๊ฒฝ์ฐ
return key
else: # participant์ ์๋๋ฐ ๋๋ช
์ด์ธ์ผ๋ก ์๊ฐ ๋ค๋ฅธ ๊ฒฝ์ฐ
if value != comp[key]:
return key