Balanced Binary Tree

Easy
Trees Tree DFS

Given a tree as level-order array, determine if it is height-balanced.

Constraints

Nodes ≤ 5000

Examples

Example 1:
Input: 3 9 20 null null 15 7
Output: true
Example 2:
Input: 1 2 2 3 3 null null 4 4
Output: false
▲ Console

Install Talent Arabia

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