LeetCode - 150 - Balanced Binary Tree

The problem 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. Examples Input: root = [3,9,20,null,null,15,7] Output: true Input: root = [1,2,2,3,3,null,null,4,4] Output: false Input: root = [] Output: true Constraints The number of nodes in the tree is in the range [0, 5000]. -10^4 <= Node.val <= 10^4 Explanation From the description of the problem, we learn that we need to find if the tree is height-balanced, and that we can do it by determining if the difference between the height of every single node in the left and right subtrees is no more than 1. ...

July 30, 2025 · 4 min · Dmytro Chumakov