head is a list sorted in increasing order. Delete duplicates so that each value appears once and return the list.
The tests show a list as a Python list of its values: [1, 2, 3] stands for 1 -> 2 -> 3.
Example 1
Input:
remove_duplicates_sorted(head) # head = 1 -> 1 -> 2
Output:
[1, 2]
Example 2
Input:
remove_duplicates_sorted(head) # head = 1 -> 1 -> 2 -> 3 -> 3
Output:
[1, 2, 3]
0 <= number of nodes <= 100000No results yet
Run your code to check it against the examples, or submit to run every test.