MEDIUMasked at 21 companies

Copy List with Random Pointer

A medium-tier problem at 61% community acceptance, tagged with Hash Table, Linked List. Reported in interviews at Mobileye and 20 others.

Founder's read

You're copying a linked list, but each node has a random pointer that can point anywhere in the list. Meta, Nvidia, and Intel ask this regularly. The trap is that a naive deep copy breaks the random references, and candidates often waste time rebuilding the pointer map mid-interview. It's a medium-difficulty problem that hits hard because the solution isn't obvious until you see the pattern. If you blank on the trick during your live assessment, StealthCoder surfaces a working solution in seconds, invisible to the proctor.

Companies asking
21
Difficulty
MEDIUM
Acceptance
61%

Companies that ask "Copy List with Random Pointer"

If this hits your live OA

Copy List with Random Pointer is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by a senior engineer who knows the OA is theater. This is the script.

Get StealthCoder
What this means

The core challenge: you can't just clone nodes and adjust pointers on the fly, because the random pointer might point to a node you haven't cloned yet. The standard approach uses a hash map to store the mapping between original and cloned nodes. First pass builds all cloned nodes and stores the mapping. Second pass iterates again and wires up both next and random pointers using the map. Some candidates try to solve it in one pass and hit a wall when they realize random pointers aren't guaranteed to be cloned. The Hash Table and Linked List topics are exact. If you hit this problem live and freeze on the two-pass structure, StealthCoder runs invisibly and delivers the hash-map solution before you lose interview momentum.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Copy List with Random Pointer recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by a senior engineer who knows the OA is theater. This is the script. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Copy List with Random Pointer interview FAQ

Is this actually asked at FAANG companies?+

Yes. Meta, Nvidia, and Intel are in the data, plus Docusign and Snowflake. It's not as common as basic array problems, but it appears in most rounds as a second-pass screening filter. Acceptance rate is around 60%, which means it's doable but not trivial.

What's the trick that most candidates miss?+

Trying to solve it in a single pass. You can't wire random pointers to nodes that don't exist yet. The hash map approach forces a two-pass structure: first build all clones, then link them. Once you see that pattern, the code is straightforward.

How does the random pointer change the difficulty compared to a standard linked list copy?+

Standard linked list copy only needs to follow the next pointer, so a single pass works. The random pointer breaks that because it can jump anywhere. You need to decouple node creation from pointer wiring, which is why the hash table becomes mandatory.

Can you solve it without a hash table?+

Yes, there's a three-step approach: interweave the cloned nodes into the original list, copy random pointers, then separate the lists. But it's harder to code under pressure and mutates the input. The hash map method is cleaner and what most interviewers expect.

What should I practice before my assessment?+

Understand why the hash map is necessary, not just how to code it. Practice the two-pass pattern until it's muscle memory. Time yourself on a few similar linked list problems. Know the space and time tradeoffs. If you get stuck on the real OA, that's where StealthCoder is your safety net.

Want the actual problem statement? View "Copy List with Random Pointer" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.