def remove_dups(head):
hashset = set()<EOL>prev = Node()<EOL>while head:<EOL><INDENT>if head.val in hashset:<EOL><INDENT>prev.next = head.next<EOL><DEDENT>else:<EOL><INDENT>hashset.add(head.val)<EOL>prev = head<EOL><DEDENT>head = head.next<EOL><DEDENT>
Time Complexity: O(N)
Space Complexity: O(N)