Created
February 18, 2019 08:37
-
-
Save rpf5573/f229a8fcef2781cdb246bb3ba4a7a393 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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