Remove Duplicates In A Sorted Linked List
easy
1. You are given a partially written LinkedList class. 2. You are required to complete the body of removeDuplicates function. The function is called on a sorted list. The function must remove all duplicates from the list in linear time and constant space 3. Input and Output is managed for you.
Constraints
1. Time complexity -> O(n) 2. Space complexity -> constant
Format
Input
Input is managed for you
Output
Output is managed for you
Example
Sample Input
10
2 2 2 3 3 5 5 5 5 5
Sample Output
2 2 2 3 3 5 5 5 5 5
2 3 5
Question Video