FastPrepAre Two Binary Trees Mirror Images
Problems/Are Two Binary Trees Mirror Images

Are Two Binary Trees Mirror Images

Adobe logoAdobe● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: This problem checks whether flipping one binary tree left to right gives another tree. The report is a post from April 2022 about a rejected MTS-1 application in India. The author graduated in 2021 and found the opening on a job site. The task came from the first live interview, which followed an online test. OS basics (semaphores, threads) and a task that reverses list nodes in groups were asked in the same interview. The post states the task in one line and gives no rules, limits or examples.

Our choices: values count, so a mirror must match values as well as shape. Each tree has 1 to 1000 nodes, with values from -1000 to 1000 that may repeat. The answer is true or false. The examples are new.

Our version is about 90% the same as the reported question.

Given the roots of two binary trees, root1 and root2, return true if the second tree is the mirror image of the first, and false otherwise.

The mirror image of a tree is what you get by flipping it left to right: every node keeps its value, but its left and right subtrees trade places, all the way down. So two trees are mirror images when their roots have equal values, the left subtree of the first root is the mirror image of the right subtree of the second root, and the right subtree of the first root is the mirror image of the left subtree of the second root.

Function

areMirrors(root1: TreeNode, root2: TreeNode) → boolean

Examples

Example 1

root1 = [7,3,9,null,4]root2 = [7,9,3,null,null,4]return = true
root1
7349
root2
7934

Flip the first tree left to right: 9 becomes the left child of 7 and 3 the right child, and 4, the right child of 3, becomes its left child. That is exactly the second tree, so the answer is true.

Example 2

root1 = [7,3,9,null,4]root2 = [7,9,3,null,null,null,4]return = false
root1
7349
root2
7934

The top two levels match the flipped first tree, but 4 is the right child of 3 in the second tree. In the flipped first tree it must be the left child of 3, so the answer is false.

Example 3

root1 = [10,20]root2 = [10,20]return = false
root1
1020
root2
1020

The two trees are the same, but they are not mirror images: flipping the first tree moves 20 to the right of 10, while in the second tree 20 is on the left. The answer is false.

Constraints

  • Each tree has 1 to 1000 nodes.
  • -1000 <= Node.val <= 1000, and values may repeat

More Adobe Phone Screen questions

  • Evaluate a Parenthesized Integer ExpressionPHONE SCREEN · Seen Oct 2026
  • All Elements of Two BSTs in OrderPHONE SCREEN · Seen Aug 2026
  • Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
  • Binary Tree Level-Order Traversal by LevelsPHONE SCREEN · ONSITE INTERVIEW · Seen Aug 2026
  • Count Occurrences in a Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026
  • Count Pairs with Absolute Difference KPHONE SCREEN · Seen Jul 2026
  • Count Subsets with Sum KPHONE SCREEN · Seen Jul 2026
  • Numbers with Exactly Three DivisorsPHONE SCREEN · Seen Jul 2026
  • Sum of Even Nodes on a Path in a Numbered Binary TreePHONE SCREEN · Seen Jul 2026
  • Largest Value in Every Sliding WindowPHONE SCREEN · Seen Jul 2026

Similar questions at other companies

  • Symmetric Binary TreeDocuSign · PHONE SCREENDocuSign interview questions
  • Maximum Depth of Binary TreeLinkedIn · PHONE SCREEN · ONSITE INTERVIEWLinkedIn interview questions
  • Left View of a Binary TreeMygate · PHONE SCREENMygate interview questions
  • Find All Paths for a Name in a File SystemThe Walt Disney Company · PHONE SCREENThe Walt Disney Company interview questions
  • Tree Height After Child PromotionSnowflake · PHONE SCREENSnowflake interview questions
  • Binary Tree Spiral Level OrderAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Check a Complete Binary TreeGoldman Sachs · PHONE SCREENGoldman Sachs interview questions
  • Tree DiameterQualcomm · PHONE SCREENQualcomm interview questions
  • Frog Position After T SecondsInMobi · PHONE SCREENInMobi interview questions
  • Distance Between Two Nodes in a Binary TreeBloomberg LP · PHONE SCREENBloomberg LP interview questions

Interview reports that mention this question

  • Adobe New Grad MTS Interview Questions: 7 Experiences

Adobe interview experiences

  • Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
  • Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
  • Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
  • Adobe ML/Research Intern Interviews: 12 Experiences (Part 4 of 4)
  • Adobe Product Intern Interviews: 15 Experiences (Part 3 of 4)
All Adobe interview questionsSee Adobe hiring insights
Saved
/**
 * Definition for a binary tree node.
 * public class TreeNode {
 *     int val;
 *     TreeNode left;
 *     TreeNode right;
 *     TreeNode() {}
 *     TreeNode(int val) { this.val = val; }
 *     TreeNode(int val, TreeNode left, TreeNode right) {
 *         this.val = val;
 *         this.left = left;
 *         this.right = right;
 *     }
 * }
 */
class Solution {
    public boolean areMirrors(TreeNode root1, TreeNode root2) {
        // Write your code here.
    }
}
Checking account…