Share a short code


  • 0
    L
    ListNode* removeElements(ListNode* head, int val) {
        if(head==NULL) return NULL;
        ListNode* tails=removeElements(head->next, val);
        return head->val==val? head=tails: head->next=tails, head;
    }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.