Amazon | Phone | Mirror Equal Trees

Position: SDE Intern

Given two binary trees, they are said to be mirror equal to each other iff view of their leaves are mirrored image of each other.

SOLUTION

  1. Do in-order traversal of tree, and push each leaf node into an ArrayList(in java)/ vector(in c++)
  2. Do the above process for both the trees
  3. Answer is YES if one list is equal to other's reverse
Comments (6)