TheAlgorithms-C/leetcode/src/82.c
2019-09-26 08:29:31 -07:00

14 lines
422 B
C

struct ListNode* deleteDuplicates(struct ListNode* head) {
if(head == NULL)
return NULL;
if(head->next && head->val == head->next->val) {
/* Remove all duplicate numbers */
while(head->next && head->val == head->next->val)
head = head -> next;
return deleteDuplicates(head->next);
} else {
head->next = deleteDuplicates(head->next);
}
return head;
}