Loading problem…
Given the `head` of a sorted linked list, delete all duplicates such that each element appears only **once**. Return the linked list **sorted** as well.
Example 1
Input: head = [1,1,2]
Output: [1,2]
Explanation: The second 1 is removed.
Example 2
Input: head = [1,1,2,3,3]
Output: [1,2,3]
Explanation: Both runs of duplicates collapse to a single value each.
Example 3
Input: head = [1]
Output: [1]
Explanation: A one-node list has no duplicates.
The list is already sorted, so duplicates are adjacent. Walk one pointer; whenever the next node has the same value, splice it out by pointing past it; otherwise advance.
Run checks all cases above. Submit evaluates all test cases.