mirror of
https://github.moeyy.xyz/https://github.com/TheAlgorithms/C.git
synced 2023-10-11 15:56:24 +08:00
83d3234fe2
Update BubbleSort.c
16 lines
438 B
C
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;
|
|
}
|