Skip to main content
Copy List with Random Pointer
mediumNeetCode 150

Copy List with Random Pointer

Copy List with Random Pointer is Clone Graph wearing a linked-list costume: random can point anywhere, so you cannot copy in one naive pass. A map from old node to new node lets you wire next and random after every copy exists. The O(1)-space interleaving trick is the flex once the map version clicks.

Linked ListArrays & Hashing

Chat with Fin or Coco right now on mobile.

Start talking through the problem here. Switch to desktop when you're ready to code and run tests.

Start coaching session
Coco
Fin

Meet your coaches

Talk through the problem while you code. Guest text is free. Hosted voice is the Own Words Pack.

1Copy List with Random Pointermedium
Based onLeetCode

Code + tests need a desktop

Chat works on this phone. Email yourself a link when you want the editor and tests.