Grokking Tree Coding Patterns for Interviews
Ask Author
Back to course home

0% completed

Vote For New Content
Symmetric Tree (easy)
On this page

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!

On this page