Symmetric Binary Tree
Reported by candidates from Figma's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Figma reportedly asked Symmetric Binary Tree in February 2026, and the 10^5 node cap is the detail that matters. Anything that rebuilds or copies subtrees per comparison gets ugly fast, so you want one clean pass over the tree. This is a tree problem with a mirror twist. If you've seen it before, it takes ten minutes. If you blank, StealthCoder is the invisible safety net running during the live OA, reading the problem and handing you a working solution. Know the trick first, though. It's short.
The problem
Given the root of a binary tree, return true when the tree is symmetric around its center and false otherwise. Two subtrees mirror each other when their root values are equal, the left subtree of one mirrors the right subtree of the other, and 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 The left and right subtrees have equal values in mirrored positions. Example 2 root = [1,2,2,null,3,null,3] return = false The two nodes with value 3 occupy the same side of their parents instead of mirrored sides. Example 3 root = [] return = true An empty tree has no mismatched pair, so it is symmetric. Constraints The tree contains at most 10^5 nodes. Each node value fits in a signed 32-bit integer. The empty tree is symmetric.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The trick is to stop treating the tree as one thing. Write a helper that takes two nodes, a and b, and checks whether they mirror each other. Both null means true. One null means false. Values differ means false. Otherwise recurse on (a.left, b.right) and (a.right, b.left). Call it with (root.left, root.right). That's O(n) time and O(h) space. The common pitfall is comparing left and right in the same direction, which checks equality instead of symmetry. Example 2 catches that exactly. Another trap is forgetting the empty tree returns true. With up to 10^5 nodes, a skewed tree can make recursion depth huge, so an iterative version with a queue or stack of node pairs is safer. If you freeze on the pair logic during the OA, StealthCoder is the hedge that gets you unstuck without anyone seeing it.
Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.
You can drill Symmetric Binary Tree cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.
Get StealthCoderRelated leaked OAs
This OA pattern shows up on LeetCode as symmetric tree. If you have time before the OA, drill that.
You've seen the question.
Make sure you actually pass Figma's OA.
Figma reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Symmetric Binary Tree FAQ
What's the trick to Symmetric Binary Tree?+
Compare two nodes at once instead of one. Write isMirror(a, b) that checks values match, then recurses on a.left with b.right and a.right with b.left. Start with root.left and root.right. Handle both-null as true and one-null as false before touching values.
How hard is this problem really?+
It's an easy-level tree question. The logic fits in about ten lines once you see the paired recursion. The risk isn't difficulty, it's nerves. Most failures come from comparing same-side children or missing the null cases, not from the algorithm itself.
Should I use recursion or iteration with 10^5 nodes?+
Both run in O(n). A badly skewed tree could reach depth near 10^5 and risk a stack overflow in some languages. An iterative queue of node pairs avoids that. If you're confident the recursion limit is fine, recursion is shorter and easier to get right.
What edge cases should I test before submitting?+
Test the empty tree, which returns true. Test a single node, also true. Test Example 2 where both children hold 3 on the same side, which must return false. Test a case where values match but one side has an extra null. Those cover most wrong answers.
How do I prepare for this in 48 hours?+
Write the paired recursive helper from memory twice, then write the iterative queue version once. Run Examples 1 to 3 by hand. Also be ready for the follow-up of explaining time and space complexity. That's enough for this pattern since it's mostly one idea.