Given a list of integers, return a new list with all duplicates removed, preserving order.
Example: [4,1,2,2,3,4] -> [4,1,2,3]
My Python solution:
def remove_duplicates(duplicated):
d = dict()
result = []
for val in duplicated:
if val not in d:
d[val] = 1
result.append(val)
return result