Dsa
Trees
Warm-up
Mirror of a Tree
Given the root of a binary tree, return whether the tree is the mirror of itself (symmetric around its center). If the tree is empty, consider it symmetric.
Input format:
A single line containing integers, the first number is the number of nodes followed by node values in a level order (use -1 for null nodes).
Output format:
Return 'True' if the tree is symmetric, 'False' otherwise.
Example:
Input:
7 1 2 2 3 4 4 3 -1 -1 -1 -1 -1 -1
Output:
True
Key concepts
treesmirrorbinary trees
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now