You are viewing a single comment's thread. Return to all comments →
Here, my solution:
SinglyLinkedListNode* removeDuplicates(SinglyLinkedListNode* llist) { SinglyLinkedListNode* prev; SinglyLinkedListNode* curr = llist; while(curr != NULL) { prev = curr; curr = curr->next; while(curr != NULL && curr->data == prev->data){ prev->next = curr->next; curr = curr->next; } } return llist; }
Seems like cookies are disabled on this browser, please enable them to open this website
Delete duplicate-value nodes from a sorted linked list
You are viewing a single comment's thread. Return to all comments →
Here, my solution: