138.Copy-List-with-Random-Pointer
138. Copy List with Random Pointer
题目地址
https://www.lintcode.com/problem/copy-list-with-random-pointer/
https://leetcode.com/problems/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.代码
Approach #1 Recursive
Complexity Analysis
Time Complexity: O(N)
Space Complexity: O(N)
Approach #2 Iterative with O(N) Space
// Solution 2:
Last updated
Was this helpful?