Symmetric Tree
Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center).

30:00

Symmetric Tree
easy
Topics
Companies

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
Constraints:
  • The number of nodes is in the range [1,1000][1, 1000].

  • 100Node.val100-100 \leq \text{Node.val} \leq 100

Input
arr ={"root":[1,2,2,3,4,4,3]}

1

2

2

3

4

4

3

Variables
VariableValue
left2
right2
DepthFunction Call
0dfsleft=2, right=2
0/13