Height balanced binary tree
Your task
Given a binary tree as a level-order array arr (null for missing), return True if it is height-balanced, for every node, the heights of its two subtrees differ by at most 1, and False otherwise. An empty tree is balanced. 0 <= node count <= 50000.
Examples
is_balanced(arr: list[int]) -> boolExample 1
Input
is_balanced([3, 9, 20, None, None, 15, 7])Output
True