Another method involves utilizing a Depth-First Search (DFS) approach. We begin at the root and recursively determine the height of both the left and right subtrees for each node. class TreeNode ( object ) : def __init__ ( self , x ) : self . val = x self . left = None self . right = None def isBalanced ( self , root ) : def check ( root ) : if root is None : return 0 left = check ( root . left ) right = check ( root . right ) if left == - 1 or right == - 1 or abs ( left - right ) > 1 : return - 1 return 1 + max ( left , right ) return check ( root ) != - 1 This Python code defines the isBalanced method along with a helper function called check , which assesses whether the tree rooted at a given node is height-balanced. We implement a post-order traversal to verify the balance of the left subtree first, followed by the right subtree, and finally the node itself. If we discover that any subtree is unbalanced during the traversal, we return -1, ceasing further checks, which leads to the conclusion that the entire tree is not balanced.