Given the root of a binary tree, return True if it is height-balanced, otherwise return False.
A binary tree is height-balanced if for every node in the tree, the depth of the left and right subtrees differs by at most 1.
Example 1:
3
/ \
9 20
/ \
15 7
Input: root = [3,9,20,null,null,15,7] Output: True Explanation: Every node has left/right subtree heights differing by at most 1.
Example 2:
1
/ \
2 2
/ \
3 3
/ \
4 4
Input: root = [1,2,2,3,3,null,null,4,4] Output: False Explanation: The left subtree has height 4 while the right has height 1; difference exceeds 1.
Example 3:
Input: root = [] Output: True Explanation: An empty tree is trivially balanced.
[0, 5000].-10^4 <= Node.val <= 10^4root = [3,9,20,null,null,15,7]