Copy
138. Copy List with Random Pointer
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.
Return a deep copy of the list.
Example 1:

My Solutions:
方法1:用hashmap储存node和TA的复制品node‘,每一次copy连上的是一定是复制品
Time: O(n); Space: O(n)
方法2:in place, Time: O(n); Space: O(1)
Last updated