Remove the duplicates from a linked-list.
Anonymous
I asked what was stored in the linked-list nodes, and the interviewer said "integers". I made a HashMap to store the values from the ListNodes. I iterated through the list, checking if they exist in the HashMap. If not, add the value of each node to the HashMap and move on. If so, remove the item from the LinkedList and move on. I'm not sure if this is the fastest way to do this.
Check out your Company Bowl for anonymous work chats.