Search
⌘K

Leetcode 1485. Clone Binary Tree With Random Pointer

Given a binary tree where each node has left, right, and an extra random pointer to any node (or null), produce a deep copy of the tree so the cloned nodes replicate the original tree's left/right structure and random relationships. This requires traversing the tree and mapping original nodes to their clones (e.g., via a hash map or an in-place interleaving trick) to correctly assign random pointers.

Asked at:

Meta


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Early February, 2025

Meta

Staff

Comments

Your account is free and you can post anonymously if you choose.