Given a binary tree, determine if it is height-balanced. A height-balanced binary tree is a binary tree in which the depth of the two subtrees of every node never differs by more than one.
Example 1
Input: root = [3,9,20,null,null,15,7]
Output: true
Explanation: Node 9 is a leaf (height 1) and node 20 has two leaf children (height 2). The heights differ by 1, and every smaller subtree is balanced too, so the tree is height-balanced.
Example 2
Input: root = [1,2,2,3,3,null,null,4,4]
Output: false
Explanation: The root's left subtree goes 2 → 2 → 3 → 4, a height of 3, while its right subtree is a single node 2 with height 1. The heights differ by 2, so the tree is not balanced.
Example 3
Input: root = []
Output: true
Explanation: An empty tree has no nodes whose subtrees could differ, so it counts as balanced.
Compute each subtree's height once, bottom-up. As soon as any subtree is unbalanced, propagate a sentinel (-1) upward so the whole tree short-circuits to unbalanced.
Run checks all cases above. Submit evaluates all test cases.