1624. Clone Binary Tree With Random Pointer

Medium
Hash Table
Tree
Depth-First Search
Breadth-First Search
Binary Tree

Description

Hints

Hint 1
Traverse the tree, keep a hashtable with you and create a nodecopy for each node in the tree.
Hint 2
Start traversing the original tree again and connect the left, right and random pointers in the cloned tree the same way as the original tree with the help of the hashtable.

Statistics

Acceptance
80.9%
Submissions
43,889
Accepted
35,505