TreeDFSBFS
Decide whether a binary tree is a mirror image of itself, meaning the left subtree is a reflection of the right subtree. Build the tree from the level-order input yourself, then solve the problem.
Input
A single line giving the tree in level order, with the word null for a missing child (for example 3 9 20 null null 15 7).
Output
Print true if the tree is symmetric, otherwise false.
Constraints
1 <= number of nodes <= 1000
Example 1
Input
1 2 2 3 4 4 3
Output
true
Both halves are reflections of each other.
Example 2
Input
1 2 2 null 3 null 3
Output
false
The 3s are on the same side in both subtrees, so it is not symmetric.