LeetCode 101

Symmetric Tree

Concepts:

Tree

Description: Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center).

Optimal Approach

Simple recursion on the root's left and right children, check the current nodes values and then check if the left subtree of the left child is equal to the right subtree of the right child and vice versa.

Time: O(n)

Space: O(1), Recursive stack space: O(n)

All Problems