C++ Bottom up solution [O(N) solution]
Bottom Up Approach\n\n##### Space Complexity: O(N), Time Complexity: O(N)\n\nclass Solution {\npublic:\n    bool ans;\n    int checkBalance(TreeNode* root){\n  
## **Bottom Up Approach**\n\n##### Space Complexity: O(N), Time Complexity: O(N)\n```\nclass Solution {\npublic:\n    bool ans;\n    int checkBalance(TreeNode* root){\n        if(!root)\n            return 0;\n        if(!ans) // if Answer is already False then return it.\n            return 0;\n        int leftSubTree = checkBalance(root->left);\n        int rightSubTree = checkBalance(root->right);\n        if(abs(leftSubTree-rightSubTree) > 1){\n            ans = false;\n        }\n        return 1 + max(leftSubTree, rightSubTree);\n    }\n    bool isBalanced(TreeNode* root){\n        ans = true;\n        int temp = checkBalance(root);\n        return ans;\n    }\n};\n```\n\nFeel free to ask any doubts in the **comment** section. I will try to respond **ASAP**.\nIf you like this solution, do **UPVOTE**.\nHappy Coding :)
['Recursion', 'C', 'Binary Tree', 'C++']