A simple C++ solution using a depth-finding helper function
Simple C++ solution that uses helper function depth:\n   \n    class Solution {\n    public:\n        /*********//\n        int depth(TreeNode root){\n         
Simple C++ solution that uses helper function depth:\n   \n    class Solution {\n    public:\n        /************************************************************//\n        int depth(TreeNode* root){\n            if (!root) return 0;                            //base case\n            int left = depth(root->left) + 1;         //explore left\n            int right = depth(root->right) + 1;    //explore right\n    \n            if (abs(left-right) > 1  ||  left < 1 || right < 1 ) { \n                return -1;\n            }\n\n            return (max(left,right));   \n        }\n        \n       /************************************************************//\n        bool isBalanced(TreeNode* root) {\n            if (depth(root)<0) return false;\n            return true;\n        }\n    };
['Recursion', 'Binary Tree', 'C++']