I got wrong answer but I just can't where the problem lies.

```
public:
int maxHeight(TreeNode* node){
if(!node){
return 0;
}
return max(maxHeight(node->left), maxHeight(node->right)) + 1;
}
int minHeight(TreeNode* node){
if(!node){
return 0;
}
return min(minHeight(node->left), minHeight(node->right)) + 1;
}
bool isBalanced(TreeNode* root) {
if(!root){
return true;
}
return (maxHeight(root) - minHeight(root) <= 1);
}
```