Solution: Balanced Binary Tree

Let's solve the Balanced Binary Tree problem using the Tree Depth-first Search pattern.

Statement

Given a binary tree with nn nodes, return TRUE if it is height-balancedA binary tree is considered height-balanced if the difference between the heights of the two subtrees for each node is not more than 1.. Otherwise, return FALSE.

Note: The height of an empty tree is 00.

Constraints:

  • 1n5001 \leq n \leq 500
  • 104-10^4 \leq
...