Diwali Offer!Flat 20% OFF
Enroll Now
PrakalpanaLive online tech training

115. Symmetric Tree

EasyDay 34 of 60Trees & BST

Given the root of a binary tree, return true if the tree is a mirror image of itself around its center, meaning the left subtree is the reflection of the right subtree.

Example 1
Input: root = [1,2,2,3,4,4,3]
Output: true
Example 2
Input: root = [1,2,2,null,3,null,3]
Output: false
Both 3s are right children, so the two sides are not reflections.
Constraints
  • The number of nodes is in the range 1 to 1000
  • -100 <= Node.val <= 100
Hints
Frequently asked at: Microsoft, Amazon, LinkedIn, Bloomberg
Ctrl + Enter runs the examples

Not sure what to learn next?

A 1-on-1 session with an industry mentor and a roadmap built for you. How it works

  1. 1Discuss your goals
  2. 2Get a personal plan
  3. 3Start learning
Book for β‚Ή200/ 30 min