101. Symmetric Tree
Practice Symmetric Tree for free on NudgeCode: Easy, Binary Tree pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.
Decide whether a binary tree is a mirror image of itself: fold it down the middle and every node on the left must land on a node with the same value on the right. An empty tree counts as symmetric.
Trees are written in level order, with null for a missing child.
Example
root = [1,2,2,3,4,4,3] -> true
root = [1,2,2,null,3,null,3] -> false
Constraints
- 0 <= number of nodes <= 1000
- -100 <= Node.val <= 100