Symmetric Tree
Given the root of a binary tree, return true if it is a **mirror of itself** — symmetric around its center.
A tree is symmetric when its left subtree is the mirror image of its right subtree: matched nodes hold equal values, and a left child on one side corresponds to a right child on the other.
The tree is given as a level-order array where null marks a missing child: [1, 2, 2, 3, 4, 4, 3] is symmetric.
Example cases
- symmetricin root = [1,2,2,3,4,4,3]3241423out trueThe left subtree mirrors the right: 2=2, 3↔3, 4↔4.
- asymmetricin root = [1,2,2,null,3,null,3]23123out falseBoth 2s have a right child but no left child, so they don't mirror.
- single nodein root = [1]1out true
Constraints
- The number of nodes in the tree is in the range [1, 1000].
- -100 <= Node.val <= 100
root =
[1,2,2,3,4,4,3]