Share my c solution


  • 1
    E
    void deleteNode(struct ListNode* node) {
        if(node==NULL||node->next==NULL) return;
        while(node->next->next!=NULL){
            node->val=node->next->val;
            node=node->next;
        }
        node->val=node->next->val;
        node->next=NULL;
    }

Log in to reply
 

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