Remove Duplicates from List
LINKED LIST

Problem

Given the head of a sorted linked list, delete all duplicates such that each element appears only once. Return the head of the modified linked list.

Examples

deleteDuplicates([1,2,2,3,3,3]) // returns [1,2,3] deleteDuplicates([1,1,1]) // returns [1]
Loading...
1
2
2
3
3
3