Symmetric Tree
Medium
Question
Given the root of a tree, return whether the tree is symmetric.
Input: root = [1, 2, 2, 3, 4, 4, 3]
Output: True
Input: root = [1, 2, 2, 3, 4, 4, 4]
Output: False
Input: root = [1, 2, 2, 3, None, 3, None]
Output: False
Clarify the problem
What are some questions you'd ask an interviewer?
Understand the problem
Which of these trees are NOT symmetric?
[1]
[5, 3, 3, 7, None, None, 7]
[3, 3, 3, None, 3, 3, None]
[5, 5, 5, 5, None, 5, None]
Take a moment to understand the problem and think of your approach before you start coding.