8. Symmetric Tree
easyAsked at NotionDetermine whether a binary tree is a mirror of itself. Notion likes this for the dual-pointer recursion that introduces tree-symmetry thinking.
By Alex Chen, Founder, InterviewChamp.AI · Last verified
Source citations
Public interview reports confirming this problem appears in Notion loops.
- Glassdoor (2026-Q1)— Notion uses it to test mirror recursion.
- Blind (2025-10)— Reported in onsite tree round.
Problem
Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center).
Constraints
The number of nodes in the tree is in the range [1, 1000].-100 <= Node.val <= 100
Examples
Example 1
root = [1,2,2,3,4,4,3]trueExample 2
root = [1,2,2,null,3,null,3]falseApproaches
1. BFS level + palindrome check
Collect each level (including nulls) into an array, check if it's a palindrome.
- Time
- O(n)
- Space
- O(w)
function isSymmetric(root) {
let q = [root];
while (q.length) {
const vals = q.map(n => n ? n.val : null);
let i=0, j=vals.length-1;
while (i < j) { if (vals[i] !== vals[j]) return false; i++; j--; }
const next = [];
for (const n of q) if (n) { next.push(n.left); next.push(n.right); }
q = next;
}
return true;
}Tradeoff: Works but more bookkeeping than the dual recursion.
2. Dual recursion (optimal)
Compare left.left with right.right AND left.right with right.left. Both null = symmetric here; one null = asymmetric; values differ = asymmetric.
- Time
- O(n)
- Space
- O(h)
function isSymmetric(root) {
function mirror(a, b) {
if (!a && !b) return true;
if (!a || !b) return false;
return a.val === b.val
&& mirror(a.left, b.right)
&& mirror(a.right, b.left);
}
return mirror(root.left, root.right);
}Tradeoff: Clean and tiny. The cross-pairing (left-right with right-left) is the key insight.
Notion-specific tips
Notion grades whether you immediately see this as 'Same Tree, but with cross-pairing.' If you reuse the LC 100 pattern and just flip the recursive arguments, that's the cleanest sign. Don't write a separate iterative solution unless asked.
Common mistakes
- Comparing left subtree to itself instead of cross-pairing with right.
- Forgetting the both-null base case.
- Trying to handle the root specially — start the recursion at (root.left, root.right).
Follow-up questions
An interviewer at Notion may pivot to one of these next:
- Same Tree (LC 100).
- Mirror the tree in-place (Invert Tree, LC 226).
- What if it's an N-ary tree?
Solve it now
Free. No sign-up. Python and JavaScript run instantly in your browser.
FAQ
Why cross-pair the children?
Mirror symmetry means the leftmost child of the left subtree should equal the rightmost child of the right subtree. That's the cross pattern.
Iterative is asked — what's the trick?
Use a queue, but enqueue PAIRS of nodes (the two cross-paired nodes). Dequeue a pair, compare, then enqueue 4 sub-pairs.
Practice these live with InterviewChamp.AI
Drill Symmetric Tree and other Notion interview questions under real-loop conditions with instant feedback on your reasoning, complexity claims, and code.
Practice these live with InterviewChamp.AI →