1836. Remove Duplicates From an Unsorted Linked List
Last updated
Last updated
**Input:** head = [1,2,3,2]
**Output:** [1,3]
**Explanation:** 2 appears twice in the linked list, so all 2's should be deleted. After deleting all 2's, we are left with [1,3].
**Input:** head = [2,1,1,2]
**Output:** []
**Explanation:** 2 and 1 both appear twice. All the elements should be deleted.
**Input:** head = [3,2,2,1,3,2,4]
**Output:** [1,4]
**Explanation:** 3 appears twice and 2 appears three times. After deleting all 3's and 2's, we are left with [1,4].