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.
本文介绍了一种解决链表深拷贝的方法,该链表除了常规的next指针外还包含一个指向任意节点或null的随机指针。通过两次遍历原链表的方式,首先创建所有节点的副本,然后建立副本间的next和random连接。
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.
757

被折叠的 条评论
为什么被折叠?
