TheAlgorithms-C/leetcode/src/82.c
leoperd 83d3234fe2 Update BubbleSort.c (#343)
Update BubbleSort.c
2019-10-12 15:40:42 +05:30

16 lines
438 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;
}