FastPrepSymmetric Binary Tree
Problems/Symmetric Binary Tree

Symmetric Binary Tree

DocuSign logoDocuSign● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report describes a variant of the well-known exercise of checking whether a binary tree is a mirror of itself. We chose how the tree is given as input (level by level), what to do with an empty tree, the input limits, and the function signature.

You are given the root of a binary tree. Return true if the tree is symmetric, meaning its left side is a mirror image of its right side. Otherwise return false.

Two subtrees mirror each other when all of these hold:

  • Their roots have the same value.
  • The left subtree of one mirrors the right subtree of the other.
  • The right subtree of one mirrors the left subtree of the other.

Function

isSymmetric(root: TreeNode) → boolean

Examples

Example 1

root = [1,2,2,3,4,4,3]return = true
root
1234243

The root's two children have the same value. Their outer children match each other, and their inner children match each other. Every mirrored pair is equal, so the answer is true.

Example 2

root = [1,2,2,null,3,null,3]return = false
root
12323

The root's two children have the same value. Each of them has one child with value 3, and both of those children hang on the right side. In a mirror image they would hang on opposite sides, so the answer is false.

Example 3

root = []return = true
root
empty

The tree is empty. There is nothing to compare, so it counts as symmetric and the answer is true.

Constraints

  • The tree contains at most 10^5 nodes.
  • Each node value fits in a signed 32-bit integer.
  • The empty tree is symmetric.

More DocuSign Phone Screen questions

  • Union Area of Two RectanglesPHONE SCREEN · Seen Oct 2026
  • Execute Cursor-Based Text Editor OperationsPHONE SCREEN · Seen Sep 2026
  • Minimize Array Sum After K Halving OperationsPHONE SCREEN · Seen Sep 2026
  • Fizz and Buzz Words From 1 to nPHONE SCREEN · Seen Sep 2026
  • Two Positions That Add Up to a TargetPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • Rain Kept Between WallsPHONE SCREEN · Seen Mar 2026
  • Exact Palindrome CheckPHONE SCREEN · ONSITE INTERVIEW · Seen Apr 2022
  • Reverse the Characters of a TextPHONE SCREEN · ONSITE INTERVIEW · Seen Apr 2022
  • Rebuild a Trip From Flight TicketsPHONE SCREEN · Seen Apr 2019
  • Find the Words for Each PrefixPHONE SCREEN · Seen Sep 2018

Similar questions at other companies

  • Maximum Depth of Binary TreeLinkedIn · PHONE SCREEN · ONSITE INTERVIEWLinkedIn interview questions
  • Left View of a Binary TreeMygate · PHONE SCREENMygate interview questions
  • Mirror a Binary TreeAdobe · PHONE SCREENAdobe 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

DocuSign interview experiences

  • DocuSign SWE Intern Interviews: 27 Experiences (Part 2 of 2)
  • DocuSign SWE Intern OA Questions: 53 Experiences (Part 1 of 2)
All DocuSign interview questionsSee DocuSign 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 isSymmetric(TreeNode root) {
        // Write your code here.
    }
}
Checking account…