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.
带有一个random指针链表的拷贝。先在每个节点后面复制一个节点,然后再将复制的新节点的random指向新的节点。最后将新链表分离出来
1 | /** |
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.
带有一个random指针链表的拷贝。先在每个节点后面复制一个节点,然后再将复制的新节点的random指向新的节点。最后将新链表分离出来
1 | /** |