面试题 02.01
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:
The length of the list is within the range[0, 20000]. The values of the list elements are within the range [0, 20000]. Follow Up:
How would you solve this problem if a temporary buffer is not allowed?
Solutions
hashset
straight forward
Last updated
Was this helpful?