mirror of
https://github.moeyy.xyz/https://github.com/TheAlgorithms/C.git
synced 2023-10-11 15:56:24 +08:00
15 lines
289 B
C
15 lines
289 B
C
struct ListNode *removeElements(struct ListNode *head, int val)
|
|
{
|
|
if (head == NULL)
|
|
return NULL;
|
|
if (head->val == val)
|
|
{
|
|
return removeElements(head->next, val);
|
|
}
|
|
else
|
|
{
|
|
head->next = removeElements(head->next, val);
|
|
}
|
|
return head;
|
|
}
|