Given a sorted linked list, delete all duplicates such that each element appear only once.
Input: 1->1->2->6->21->44->44->89
Output: 1->2->6->21->44->89
The numbers 1 and 44 appeared more than once in the Input Linked List.
Input: 1->1->1->1->1->1->2
Output: 1->2
The numbers 1 is repeated many times in the given Input Linked List.
Input
0 <= Numbers <= 1000
Click to reveal
A node has a head and a next pointer. Can you use the next pointer to apply some logic for deletion?
Click to reveal
Do you actually need to delete anything? Can skipping an element work?
Click to reveal
Can you do it in place without using any additional space?