> For the complete documentation index, see [llms.txt](https://coding-9.gitbook.io/untitled/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://coding-9.gitbook.io/untitled/trees/binary-tree/easy/110.-balanced-binary-tree.md).

# 110. Balanced Binary Tree

## Problem Statement

<br>

Given a binary tree, determine if it is&#x20;

**height-balanced**.

&#x20;

**Example 1:**

![](https://assets.leetcode.com/uploads/2020/10/06/balance_1.jpg)

<pre><code><strong>Input: root = [3,9,20,null,null,15,7]
</strong><strong>Output: true
</strong></code></pre>

**Example 2:**

![](https://assets.leetcode.com/uploads/2020/10/06/balance_2.jpg)

<pre><code><strong>Input: root = [1,2,2,3,3,null,null,4,4]
</strong><strong>Output: false
</strong></code></pre>

**Example 3:**

<pre><code><strong>Input: root = []
</strong><strong>Output: true
</strong></code></pre>

&#x20;

**Constraints:**

* The number of nodes in the tree is in the range `[0, 5000]`.
* `-104 <= Node.val <= 104`

## Intuition

```
Approach: 
Find height and take abs
```

### Links

<https://leetcode.com/problems/balanced-binary-tree/description/>

### Video Links

### Approach 1:

```
```

{% code title="C++" lineNumbers="true" %}

```cpp
class Solution {
public:

    int find_height(TreeNode *root){
        if(root == NULL)
            return 0;

        int l = find_height(root->left);   //Traverse Left
        if(l == -1) return -1;    
        // if from bottom recieves -1 (tree not balanced)

        int r = find_height(root->right);  //Traverse Right
        if(r == -1) return -1;

        if(abs(l-r) >1) return -1;     

        return 1+max(l,r);
    }

    bool isBalanced(TreeNode* root) {
        if(root==NULL)
            return true;
        return find_height(root) >= 1;
    }
};
```

{% endcode %}

### Approach 2:

```
```

{% code title="C++" lineNumbers="true" %}

```cpp
```

{% endcode %}

### Approach 3:

```
```

{% code title="C++" lineNumbers="true" %}

```cpp
```

{% endcode %}

### Approach 4:

```
```

{% code title="C++" lineNumbers="true" %}

```cpp
```

{% endcode %}

### Similar Problems

###
