Copy Linked List with Random Pointer ​
Copy Linked List with Random Pointer — LeetCode
Make a deep copy of a linked list where each node has an extra random pointer to any node in the list (or null).
Approach ​
- Make dictionary, create copy of nodes one by one, without any links. Dictionary key is old node and gives back new node.
- Make the links by referring to the old list and the dictionary. Handle nulls
Remarks ​
There is one test case which just sends in a null list.