Dodomeki
Sign in

29. Symmetric Tree

Easy

A tree is symmetric when its mirror image has the same structure and the same values. Return whether the given tree has this property.

Example 1
Input: raiz = [7, 4, 4, 2, 6, 6, 2]
Output: true
Example 2
Input: raiz = [7, 4, 4, null, 3, null, 3]
Output: false
Constraints
  • 0 <= quantidade de nós <= 10^4
TreesDFS
Caso 1
raiz =
[7,4,4,2,6,6,2]
Expected =
true
Caso 2
raiz =
[7,4,4,null,3,null,3]
Expected =
false

Run checks these 2 cases. Submit runs all 6, including hidden ones.