Solution Review: Copy Mirror Tree
Let's analyze in detail how to create a mirror tree using the original binary tree.
We'll cover the following
Solution
We create a mirror image of a tree the same way we copy a tree. The only difference here is that in place of the left child pointing to the tree that is formed by the left child traversal of the input tree, this time the left child points to the tree formed by the right child traversal of the input tree. Similarly, the right child points to the tree formed by the traversal of the left child of the input tree.
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.