Skip to content

Instantly share code, notes, and snippets.

@rpf5573
Created February 18, 2019 08:37
Show Gist options
  • Save rpf5573/f229a8fcef2781cdb246bb3ba4a7a393 to your computer and use it in GitHub Desktop.
Save rpf5573/f229a8fcef2781cdb246bb3ba4a7a393 to your computer and use it in GitHub Desktop.
def solution(participant, completion):
hash_map = {}
length = len(completion)
for i in range(length):
c = completion[i]
if hash_map.get(c) == None:
hash_map[c] = 1
else:
hash_map[c] = hash_map[c] + 1
for i in range(length+1):
p = participant[i]
if hash_map.get(p) == None:
return p
hash_map[p] = hash_map[p] + 1
for key in hash_map.keys():
if hash_map[key]%2 == 1:
return key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment