Deep copy of a linked list, with an extra pointer to a random node.
Anónimo
The solution is not straightforward. 1. Insert a copy node between the original node and the next node of the original one. For example, original linkedlist is 1->2->3. After inserted nodes, it looks like 1->1->2->2->3->3. 2. Iterate through the linkedlist. For every copy node, we deep copy the next pointer and random pointer based on the original one. The time complexity is O(N) where N is the length of the linkedlist.