Check head->next when changing the first half


  • 0
    Y

    I guess the test program just as follows when relasing space:

    while (head!=NULL){
          ListNode *tmp=head;
          head=head->next;
          delete tmp;
    }
    

Log in to reply
 

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