Balanced Binary Tree
Easy
Topics
Given a binary tree, determine if it is height-balanced — for every node, the heights of its two subtrees differ by at most 1.
Example 1
Input: root = [3,9,20,null,null,15,7] Output: true
Example 2
Input: root = [1,2,2,3,3,null,null,4,4] Output: false
Constraints
- 0 <= number of nodes <= 5000
- -10^4 <= Node.val <= 10^4
Run ⌘' · Submit ⌘⏎