My solution using simple recursion.

```
class Solution {
public:
int max(int a,int b){
return (a>b)?a:b;
}
int depth(TreeNode *root){
if(!root){return 0;}
return 1+max(depth(root->left), depth(root->right));
}
int mod(int a){
if(a<0){return -1*a;
}
return a;
}
bool isBalanced(TreeNode *root) {
if(!root){return true;}
return (isBalanced(root->left)&&isBalanced(root->right)) &&( (mod(depth(root->left)-depth(root->right)))<=1?true:false);
}
};
```