Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center).
Example 1
Input: root = [1,2,2,3,4,4,3]
Output: true
Explanation: The left subtree (2 with children 3, 4) is the mirror image of the right subtree (2 with children 4, 3), so the tree is symmetric.
Example 2
Input: root = [1,2,2,null,3,null,3]
Output: false
Explanation: Both 2s have their child 3 on the right. For a mirror image, the left 2's child would have to be on the right and the right 2's child on the left, so the tree is not symmetric.
Example 3
Input: root = [1]
Output: true
Explanation: A single node is symmetric around itself.
A tree is symmetric if the left subtree is a mirror reflection of the right subtree. Two trees are mirrors if their roots match and each tree's left is a mirror of the other's right.
Run checks all cases above. Submit evaluates all test cases.