Created
December 24, 2016 18:43
-
-
Save djwashburn/b036a5d7b036f98fe5df4afc491a71a7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 return_duplicates(arr): | |
set = {} | |
for x in arr: | |
if x in set: | |
set[x] = 2 | |
else: | |
set[x] = 1 | |
ret = [] | |
for y in set.keys(): | |
if set[y] == 2: | |
ret.append(y) | |
return ret | |
print rem_dup([3,5,9,6,8,4,6,8,4,6,7,9,1,6,9,1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment