Simple c++ solution___


#1

int height(TreeNode* A){
if(A==NULL){return 0;}

return 1 + max(height(A->left),height(A->right));

}
int Solution::isBalanced(TreeNode* A) {

if(A==NULL){
    return 1;
}

int l = height(A->left);
int r = height(A->right);

if(abs(l-r)<=1 && isBalanced(A->right)&& isBalanced(A->left)){
    return 1;
}
else
return 0;

}