Utopi
a
int height(TreeNode * root){ if(root!=nullptr) return max(height(root->right),height(root->left))+1; return 0; } bool isBalanced(TreeNode* root) { if(root!=nullptr) return abs(height(root->left)-height(root->right))<2 &&isBalanced(root->right) &&isBalanced(root->left); return true; }