0 ms Beats 100.00% || easy to understand
Intuition💡 A binary tree is considered height-balanced if the absolute difference in heights of the left and right subtrees is at most 1 for every node in the t
# Intuition
💡 A binary tree is considered height-balanced if the absolute difference in heights of the left and right subtrees is at most 1 for every node in the tree.
# Approach
Get the left and right depth for each node and check if the difference is > 1 if yes then update max diff, then return true if diff <= 1 otherwise return false. 

# Complexity
- Time complexity:
O(N)

- Space complexity:
O(N)

# Code
```cpp []

class Solution {
private:
    int heightDiff(TreeNode* root, int& diff){
        if(!root)return 0;

        int left=heightDiff(root->left, diff); 
        int right=heightDiff(root->right, diff);

        diff=max(diff, abs(left-right));

    return max(left, right)+1;     
  }

public:
    bool isBalanced(TreeNode* root) {
        int diff=0;
        heightDiff(root, diff);

     return diff<=1;      
   }
};
```
# Please upvote if u like this...😌
['Recursion', 'C++']