Skip to content

Instantly share code, notes, and snippets.

@djwashburn
Created December 24, 2016 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djwashburn/b036a5d7b036f98fe5df4afc491a71a7 to your computer and use it in GitHub Desktop.
Save djwashburn/b036a5d7b036f98fe5df4afc491a71a7 to your computer and use it in GitHub Desktop.
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