Symmetric Tree

L7 Medium Trees
Concept
Mirror symmetry means comparing a "left side of the left" with a "right side of the right" — a doubled recursive comparison.
Given the root of a binary tree, return true if it is a mirror of itself (symmetric around its center).
Examples
▸ root = [1, 2, 2, 3, 4, 4, 3]
→ true
▸ root = [1, 2, 2, nil, 3, nil, 3]
→ false
▸ root = []
→ true
Progressive Hints
Hint 1 · Nudge
Mirror symmetry means comparing mirror images of the two halves of the tree.
Hint 2 · Plan
Compare the left and right subtrees as mirrors: values equal, and mirror(left.left, right.right) together with mirror(left.right, right.left).
Hint 3 · Approach
isMirror(a, b): if both nil return true; if exactly one nil return false; if a.val != b.val return false; return isMirror(a.left, b.right) and isMirror(a.right, b.left). Return isMirror(root.left, root.right).
Output
// Run your code to see the output here.