Write code to remove duplicates from an unsorted linked list.
Example1:
Input: [1, 2, 3, 3, 2, 1] Output: [1, 2, 3]
Example2:
Input: [1, 1, 1, 1, 2] Output: [1, 2]
Note:
Follow Up:
How would you solve this problem if a temporary buffer is not allowed?