3 ms C solution!


  • 1
    O

    Any C less than 3 ms?
    void deleteNode(struct ListNode* node) {
    if ( node->next == NULL || node == NULL)
    return;
    while(true)
    {
    node->val = (node->next)->val;
    if ( (node->next)->next == NULL)
    {
    node->next = NULL;
    return;
    }
    node = node->next;
    }
    }


Log in to reply
 

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