mirror of
https://github.com/TheAlgorithms/C
synced 2024-11-22 13:31:21 +03: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;
|
|
}
|