mirror of
https://github.com/TheAlgorithms/C
synced 2025-05-15 08:28:04 +03:00
11 lines
277 B
C
11 lines
277 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;
|
|
}
|