Given the head of a sorted linked list, remove all duplicates such that each element appears only once, and return the list in sorted order.
Constraints:
n n is the number of nodes in the list.
Node.val
The list is guaranteed to be sorted in ascending order.
Given the head of a sorted linked list, remove all duplicates such that each element appears only once, and return the list in sorted order.
Constraints:
n n is the number of nodes in the list.
Node.val
The list is guaranteed to be sorted in ascending order.