読者です 読者をやめる 読者になる 読者になる

Remove Duplicates from an Linked List

Problem

Write code to remove duplicates from an unsorted linked list.

FOLLOW UP

How would you solve this problem if a temporary buffer is not allowed?

How to Solve

By using HashSet, I can control if each value appears or not already. And in case I want to traverse, I can check it by using next property in LinkedListNode.

In Follow Up case

By using double while loops, I can do the same task like this.