Back to course home
0% completed
Symmetric Tree (easy)
Problem Statement
Given the root
of a binary tree, return true
if the tree is symmetric, meaning it is a mirror image of itself. Otherwise, return false
.
A tree is considered symmetric if the left subtree is a mirror reflection of the right subtree.
Examples
Example 1:
- Input: root =
[1,5,5,3,4,4,3]
- Expected Output:
true
- Justification: The tree is symmetric because the left subtree mirrors the right subtree at every level.
Example 2:
- Input: root =
[1,5,5,null,3,null,3]
- Expected Output:
false
.....
.....
.....
Like the course? Get enrolled and start learning!
Table of Contents
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible