Copy List with Random Pointer


  • 0
    L
    newNode.random = oldNode.random.next;
    

    When using 3 scans, the second scan copys the random pointers, could someone explain why it is not simply use

    newNode.random = oldNode.random;
    

    when it needs oldNode.random.next?

    Thank you very much


Log in to reply
 

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