Copy List with Random Pointer
A linked list of length n is given such that each node contains an additional random pointer, which could point to any node in the list, or null. Construct a deep copy of the list.
Copy List with Random Pointer

A linked list of length n is given such that each node contains an additional random pointer, which could point to any node in the list, or null. Construct a deep copy of the list.

Example 1:
Input: {"head":[[7,null],[13,0],[11,4],[10,2],[1,0]]}
Output: [[7,null],[13,0],[11,4],[10,2],[1,0]]
Input
arr ={"head":[[7,null],[13,0],[11,4],[10,2],[1,0]]}

Start. Map created.

cur

7

Rand: null

13

Rand: 7

11

Rand: 1

10

Rand: 11

1

Rand: 7
NULL
Variables
No variables to display
DepthFunction Call
Stack empty
0/17