Symmetric Tree

Easy
Trees Tree BFS DFS

Given a tree as level-order array (null for missing), determine if it's symmetric around center.

Constraints

Nodes ≤ 1000

Examples

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

Install Talent Arabia

Get instant access to jobs and career tools on your device.