#138 - Copy List with Random Pointer
Construct a deep copy of a linked list where each node has an additional random pointer that can point to any node in the list or null.
| Input | Output |
|---|---|
head = [[7,null],[13,0],[11,4],[10,2],[1,0]] | [[7,null],[13,0],[11,4],[10,2],[1,0]] (deep copy) |
head = [[1,1],[2,1]] | [[1,1],[2,1]] (deep copy) |
head = [[3,null],[3,0],[3,null]] | [[3,null],[3,0],[3,null]] (deep copy) |