To solve this problem, you'll have to open it on the computer

Symmetric Tree

Tree
easy
Score: 20

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

Class TreeNode:
    val (int)
    left (TreeNode)
    right (TreeNode)

Input Format

First Parameter - TreeNode root

Output Format

Return the number.

Example 1:

Input: 1 2 2 3 4 4 3
Output: 1

"1"

Example 2:

Input: 1 2 2 null 3 null 3
Output: 0

"1"

Constraints:

  • The number of nodes in the tree is in the range [1, 1000].
  • -100 <= Node.val <= 100
  • Expected Time Complexity: O(n)
  • Expected Space Complexity: O(n)
Submit code to see the your result here