Solvarch
DSA ProblemsProgressPlanRoadmapsReviewCheat SheetsCompaniesSystem DesignCS FundamentalsQuestion Bank
Theme
Problems

Symmetric Tree

Easy
treebinary-treedfsbfs

Return true if a binary tree is a mirror of itself around its center.

Input: one line — the tree in level order. Output: true or false.

Example 1
Input:
1 2 2 3 4 4 3
Output:
true
Example 2
Input:
1 2 2 null 3 null 3
Output:
false

Constraints

  • 1 ≤ nodes ≤ 1000
Watch a video walkthrough

Run your code against the sample tests, or Submit to run the full suite.