Update appNew update is available. Click here to update.
sidenav-btnClose
Topic list
Symmetric Tree
EASY
20 mins
40 upvotes
Trees
Topics (Covered in this problem)
Problem solved
Badge
Skill meter
Trees
-
-
Other topics
Problem solved
Badge
Skill meter
Strings
-
-
Matrices (2D Arrays)
-
-
Linked List
-
-
Sorting
-
-
Binary Search
-
-
Stacks & Queues
-
-
Graph
-
-
Dynamic Programming
-
-
Greedy
-
-
Tries
-
-
Arrays
-
-
SQL
-
-
Binary Search Trees
-
-
Heap
-
-
Bit Manipulation
-
-
Solve problems & track your progress
Checkout your overall progress in every topic here
Become
userLevel
Sensei
in DSA topics
Open the topic and solve more problems associated with it to improve your skills
Check out the skill meter for every topic
See how many problems you are left with to solve for cracking any stage. Score more than zero to get your progress counted.

Symmetric Tree

Contributed by
Arshit Babariya
Easy
yellow-spark
0/40
Avg time to solve 20 mins
Success Rate 82 %
Share
40 upvotes

Problem Statement

You are given a binary tree, where the data present in each node is an integer. You have to find whether the given tree is symmetric or not.

Symmetric tree is a binary tree, whose mirror image is exactly the same as the original tree.

For Example:

sym_tree

Detailed explanation ( Input/output format, Notes, Constraints, Images )
Sample Input 1:
1 2 2 3 4 4 3 -1 -1 -1 -1 -1 -1 -1 -1
Sample Output 1:
Symmetric
Explanation For Sample 1:
This is a symmetric tree:

sym_tree

Sample Input 2:
1 2 3 4 -1 -1 -1 -1 -1
Sample Output 2:
Asymmetric
Explanation For Sample 2:
This is an asymmetric tree:

sym_tree

Reset Code
Full screen
Auto
copy-code
Console