Easy · Trees

Is symmetric

Given the root of a binary tree, return true if the tree is a mirror image of itself around its center (its left subtree mirrors its right subtree in shape and values) and false otherwise. An empty tree is symmetric.

Examples

Example 1

[1,2,2,3,4,4,3] symmetric

Output: symmetric

Example 2

[1,2,2,·,3,·,3] not symmetric

Output: not symmetric

Rebuild it in the studio

Open every published interview problem, solution, scene, and memory room free, with no account.

More Trees problems