698. Remove Duplicates from Sorted Linked List
Given a sorted linked list, remove all nodes that have duplicate values, keeping only the distinct values from the original list. Return the updated linked list, which should also be sorted.
The input consists of an integer n, representing the size of the linked list, followed by n integers representing the values of the nodes.
Print the updated linked list. If there are no elements in the updated linked list, print -1 as a delimiter.
4 1 1 2 3
The number of nodes in the linked list is between 0 and 300, inclusive. Each node's value is an integer between -100 and 100. The linked list is guaranteed to be sorted in ascending order.