Given the root of a binary tree, return true if the tree is a mirror of itself around its center. Pattern focus: Trust Recursion. Compare the left subtree and right subtree as mirror images.
root = binary tree root
true if the tree is symmetric, otherwise false
Example 1:
Input:
root = [1,2,2,3,4,4,3]
Output:
true
Explanation:
The left and right subtrees are mirror images.
Example 2:
Input:
root = [1,2,2,null,3,null,3]
Output:
false
Explanation:
The subtree shapes are not mirrored.