FastPrepSymmetric Binary Tree
Problems/Symmetric Binary Tree

Symmetric Binary Tree

Capital One logoCapital One● EasyINTERNONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Three Capital One intern reports from 2020 and 2021 include a tree symmetry question. The task is to decide whether the left and right halves of a binary tree reflect each other. One of them calls the tree a BST.

None of them gives the input format or limits. Here the tree comes in level order, values may repeat, and the tree has 1 to 1000 nodes with values from -100 to 100. The BST wording is not used. A search tree with distinct values can only be symmetric when it is a single node. These are our choices.

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

Imagine flipping the tree rooted at root left to right, like a page held up to a mirror. Return true when the flipped tree is exactly the same as the original, values included, and false when it differs anywhere.

Put another way: the root's two sides must be reflections of each other. Paired nodes hold equal values, and one node's left child pairs with its twin's right child.

Function

isSymmetric(root: TreeNode) → boolean

Examples

Example 1

root = [7,4,4,9,null,null,9]return = true
root
74949

The left 4 has a 9 on its left, and the right 4 has a 9 on its right. Each side is the other's reflection, so the answer is true.

Example 2

root = [5,3,3,1,2,1,2]return = false
root
5312312

Both children are 3, but the left one has 1, 2 from left to right and the right one also has 1, 2. A reflection would need 2, 1 on the right, so the answer is false.

Example 3

root = [0,-3,-3,null,null,null,6]return = false
root
0-3-36

The two -3 nodes match, but only the right one has a child (6, on its right). The left -3 has no left child to reflect it, so the answer is false.

Constraints

  • The number of nodes in the tree is between 1 and 1000.
  • -100 <= Node.val <= 100

More Capital One Onsite Interview questions

  • Digit-Coded Card ValidationONSITE INTERVIEW · Seen Nov 2026
  • Sort ColorsONSITE INTERVIEW · Seen Oct 2026
  • Virtual Card Transaction ValidatorONSITE INTERVIEW · Seen Oct 2026
  • Banking System with Top ActivityONSITE INTERVIEW · Seen Sep 2026
  • Transaction Event StoreONSITE INTERVIEW · Seen Jul 2026
  • Shortest Path in an Unweighted GraphONSITE INTERVIEW · Seen Jul 2026
  • Duplicate Transactions Within 60 SecondsONSITE INTERVIEW · Seen May 2026
  • LRU CachePHONE SCREEN · ONSITE INTERVIEW · Seen May 2026
  • Cashback TrackerONSITE INTERVIEW · Seen Nov 2025
  • Reverse a StringOA · ONSITE INTERVIEW · Seen Oct 2025

Similar questions at other companies

  • Maximum Depth of Binary TreeLinkedIn · PHONE SCREEN · ONSITE INTERVIEWLinkedIn interview questions
  • Symmetric Binary TreeFigma · ONSITE INTERVIEWFigma interview questions
  • Tree Level with the Most NodesBloomberg LP · ONSITE INTERVIEWBloomberg LP interview questions
  • Mirror Image Binary TreesExpedia · ONSITE INTERVIEWExpedia interview questions
  • Mirror a Binary TreeAMD · ONSITE INTERVIEWAMD interview questions
  • Find a Node’s Level in an N-ary TreeMorgan Stanley · ONSITE INTERVIEWMorgan Stanley interview questions
  • Delete Nodes and Return Forest RootsGoogle · ONSITE INTERVIEWGoogle interview questions
  • Binary Tree Spiral Level OrderAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Diameter of an Acyclic Undirected GraphSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Vertical Order Traversal of a Binary TreeTokopedia · ONSITE INTERVIEWTokopedia interview questions

Capital One interview experiences

  • Capital One Experienced Engineer Power Day and OA: 6 Experiences
  • Capital One New Grad OA Questions: 14 Experiences (Part 2 of 2)
  • Capital One TDP Agentic Round (AI Coding): 7 Experiences
  • Capital One SWE Power Day, Level Not Reported: 6 Experiences
  • Capital One TIP Intern OA and Power Day: 13 Experiences
  • Capital One TDP Agentic Power Day: 25 Experiences (Part 1 of 2)
All Capital One interview questionsSee Capital One 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…