MEDIUMasked at 14 companies

Clone Graph

A medium-tier problem at 62% community acceptance, tagged with Hash Table, Depth-First Search, Breadth-First Search. Reported in interviews at Pocket Gems and 13 others.

Founder's read

Clone Graph is a medium-difficulty graph problem that shows up across Meta, Google, Uber, and at least eight other companies. You need to deep-copy a graph structure where nodes point to neighbors you haven't seen yet. The 62% acceptance rate signals it's not a gimme, and the trick isn't obvious if you haven't worked with graph traversal before. Most candidates blank on how to track visited nodes while building the clone simultaneously. If this hits your live assessment and you freeze on the traversal order, StealthCoder solves it invisibly in seconds.

Companies asking
14
Difficulty
MEDIUM
Acceptance
62%

Companies that ask "Clone Graph"

If this hits your live OA

Clone Graph 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. Made by a working FAANG engineer who treats the OA the way companies treat hiring: as a game with rules you should know.

Get StealthCoder
What this means

The problem breaks into two pieces: traverse the original graph and build a mapping from old nodes to new clones without revisiting. DFS or BFS both work, but you must handle the visited set correctly. Common failure: cloning a node before its neighbors are cloned, which breaks the reference structure. The real trap is forgetting that you're cloning edges, not just nodes, and that cycles exist. Hash Table stores the mapping. You iterate through neighbors, clone them on first visit, and link them to the current clone. The pattern repeats recursively or via a queue. StealthCoder is your hedge if you choke on the traversal logic or reference-copying order during the actual assessment.

Pattern tags

The honest play

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

Clone Graph 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. Made by a working FAANG engineer who treats the OA the way companies treat hiring: as a game with rules you should know. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Clone Graph interview FAQ

Is Clone Graph actually asked at Meta and Google?+

Yes. It appears in reports from both, plus Uber, Pocket Gems, ThousandEyes, Flexport, Wix, and six others. It's a stable graph-interview standard, not a one-off. Accept that it could land in your OA.

What's the trick that makes people fail?+

Forgetting to store the old-to-new node mapping before recursing into neighbors. You end up cloning the same node twice or breaking cycles. Hash Table lookup before clone-and-recurse is the pattern.

Should I use DFS or BFS?+

Either works. DFS is simpler to code and recursive. BFS requires explicit queue management but avoids stack depth issues on huge graphs. Pick whichever you're faster with, but know both. Most solutions use DFS.

How does this relate to the other graph topics?+

Clone Graph is pure graph traversal (DFS or BFS) plus Hash Table for memoization. It's not about shortest path, connectivity, or cycles directly. It's traversal fundamentals applied to cloning.

At 62% acceptance, how hard is it really?+

It's medium because the pattern isn't intuitive if you've never cloned a cyclic structure. Once you've solved it or studied the mapping trick, it becomes routine. One rehearsal and you'll spot it instantly in an OA.

Want the actual problem statement? View "Clone Graph" 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.