My issue
does we have to take the input in this question
My code
/* Linked List Node
struct Node {
int data;
struct Node *next;
Node(int x) {
data = x;
next = NULL;
}
}; */
class Solution {
public:
Node* removeDuplicates(Node* head) {
// your code here
if(!head || !head->next){
return head;
}
Node*curr=head;
while(curr->next){
if(curr->data=curr->next->data){
curr->next=curr->next->next;
}
else{
curr=curr->next;
}
}
return head;
}
};
Learning course: Placement preparation: Advanced
Problem Link: Remove Duplicates from Sorted List in Placement preparation: Advanced