DiffPush Tier Linked List · Hard Promblems of LL O(n) · O(n) for the n new nodes (the interleaving itself uses no map)
A relay network stores each runner's order plus a private walkie channel that can jump to any runner — or nobody at all. The operations team needs an entirely separate clone of the network: same runner values, same handoff order, and each clone's jump channel pointing at the equivalent clone runner, never at an original. In a single weaving pass, each new runner is stitched in right behind their original; the jump channels are copied by reading the neighbour of whatever the original points at; then the weave is split back into two clean, independent chains.
Input: An array pairs of n entries [value, random_index], where random_index is the 0-based position of the random target or -1 for null.
Output: The deep copy expressed the same way — n pairs [value, random_index] over brand-new nodes.
0 <= n <= 10^4-10^9 <= value <= 10^9random_index is -1 or an index in [0, n-1]Input: {"pairs":[[7,-1],[13,0],[11,4],[10,2],[1,0]]}
Output: [[7,-1],[13,0],[11,4],[10,2],[1,0]]
Every jump channel is reproduced inside the clone — e.g. the second runner's channel re-points at the clone of runner 0, never at the original.
Input: {"pairs":[[1,1],[2,1]]}
Output: [[1,1],[2,1]]
Both channels land on the same (second) runner, and the second runner's channel loops back to itself.