Balanced Binary Tree Checker
Problem Statement​
Given a binary tree, determine if it is height-balanced. A height-balanced binary tree is defined as:
note
A binary tree in which the left and right subtrees of every node differ in height by no more than one.
Solution​
We'll implement a depth-first search (DFS) approach to check if the binary tree is balanced. The idea is to recursively calculate the height of each subtree and check if the difference between the heights of left and right subtrees is not more than 1 for every node.