1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree

https://leetcode.com/problems/find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree

Description

Given two binary trees original and cloned and given a reference to a node target in the original tree.

The cloned tree is a copy of the original tree.

Return a reference to the same node in the cloned tree.

Note that you are not allowed to change any of the two trees or the target node and the answer must be a reference to a node in the cloned tree.

Follow up: Solve the problem if repeated values on the tree are allowed.

Example 1:

Example 2:

Example 3:

Example 4:

Example 5:

Constraints:

  • The number of nodes in the tree is in the range [1, 10^4].

  • The values of the nodes of the tree are unique.

  • target node is a node from the original tree and is not null.

ac

Last updated

Was this helpful?