# 110. Balanced Binary Tree

```java
class Solution {
    boolean result = true;
    public boolean isBalanced(TreeNode root) {
        // concept: height: from bottom to top
        postOrder(root);
        return result;
    }
    
    private int postOrder(TreeNode node){
        // as long as result is false, no need to trasverse the rest of the tree;
        if (node==null || !result) return 0;
        
        int leftHeight = postOrder(node.left);
        int rightHeight = postOrder(node.right);
        if (Math.abs(leftHeight-rightHeight)>1){
            result = false;
        }
        return Math.max(leftHeight, rightHeight)+1;
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ucan.gitbook.io/notes/tree/110.-balanced-binary-tree.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
