head is sorted in increasing order. Delete every node whose value appears more than once, so only values that were already distinct remain. For 1 -> 2 -> 3 -> 3 -> 4 -> 4 -> 5 the answer is 1 -> 2 -> 5.
The tests show a list as a Python list of its values: [1, 2, 3] stands for 1 -> 2 -> 3.
Example 1
Input:
remove_all_duplicates(head) # head = 1 -> 2 -> 3 -> 3 -> 4 -> 4 -> 5
Output:
[1, 2, 5]
Example 2
Input:
remove_all_duplicates(head) # head = 1 -> 1 -> 1 -> 2 -> 3
Output:
[2, 3]
0 <= number of nodes <= 100000No results yet
Run your code to check it against the examples, or submit to run every test.