Approach Summary
HashMap from original → clone. First pass: create all clone nodes. Second pass: wire next and random pointers using the map.
How to Recognize This Pattern
- "Deep copy with arbitrary pointer"
- Map ensures each node is cloned exactly once
Complexity Analysis
Time Complexity
O(n)
Space Complexity
O(n)
Tags
Hash Table Linked List