Remove Duplicates from doubly linked list
Problem Statement
Given a sorted doubly linked list containing n nodes. Your task is to remove duplicate nodes from the given list.
Example 1:
Input
1<->2<->2-<->3<->3<->4
Output:
1<->2<->3<->4
Example 2:
Input
1<->1<->1<->1
Output
1
Input
User Task:
Since this will be a functional problem, you don't have to take input. You just have to complete the function deleteDuplicates() that takes head node as parameter.
Constraints:
1 <=N <= 10000
1 <= Node. data<= 2*10000
Output
Return the head of the modified list.
Comments
Leave a comment