Development/CodingTest
[ํ๋ก๊ทธ๋๋จธ์ค] Python ์์ฃผํ์ง ๋ชปํ ์ ์
Kirok Kim
2022. 1. 13. 23:25
def solution(participant, completion):
p=sorted(participant)
c=sorted(completion)
for i in range(len(c)):
if p[i] != c[i]:
return p[i]
return p[len(p)-1]
hash๋ฅผ ์ด์ฉํ ํ์ด
def solution(participant, completion):
answer = ''
temp = 0
dic = {}
for part in participant:
dic[hash(part)] = part
temp += int(hash(part))
for com in completion:
temp -= hash(com)
answer = dic[temp]
return answer
- ...ํ์์ ์ด๋ค.....
๋ฐ์ํ