2019-09-26 08:29:31 -07:00

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;
}