Very Easy || 100% || Fully Explained (C++, Java, Python, JavaScript, Python3)
Java Solution:\nRuntime: 0 ms, faster than 100.00% of Java online submissions for Balanced Binary Tree.\nMemory Usage: 41.9 MB, less than 94.34% of Java online 
# **Java Solution:**\nRuntime: 0 ms, faster than 100.00% of Java online submissions for Balanced Binary Tree.\nMemory Usage: 41.9 MB, less than 94.34% of Java online submissions for Balanced Binary Tree.\n```\nclass Solution {\n    public boolean isBalanced(TreeNode root) {\n        // If the tree is empty, we can say it\u2019s balanced...\n        if (root == null)  return true;\n        // Height Function will return -1, when it\u2019s an unbalanced tree...\n\t\tif (Height(root) == -1)  return false;\n\t\treturn true;\n\t}\n    // Create a function to return the \u201Cheight\u201D of a current subtree using recursion...\n\tpublic int Height(TreeNode root) {\n        // Base case...\n\t\tif (root == null)  return 0;\n        // Height of left subtree...\n\t\tint leftHeight = Height(root.left);\n        // Height of height subtree...\n\t\tint rightHight = Height(root.right);\n        // In case of left subtree or right subtree unbalanced, return -1...\n\t\tif (leftHeight == -1 || rightHight == -1)  return -1;\n        // If their heights differ by more than \u20181\u2019, return -1...\n        if (Math.abs(leftHeight - rightHight) > 1)  return -1;\n        // Otherwise, return the height of this subtree as max(leftHeight, rightHight) + 1...\n\t\treturn Math.max(leftHeight, rightHight) + 1;\n    }\n}\n```\n\n# **C++ Solution:**\n```\nclass Solution {\npublic:\n    bool isBalanced(TreeNode* root) {\n        // If the tree is empty, we can say it\u2019s balanced...\n        if (root == NULL)  return true;\n        // Height Function will return -1, when it\u2019s an unbalanced tree...\n\t\tif (Height(root) == -1)  return false;\n\t\treturn true;\n\t}\n    // Create a function to return the \u201Cheight\u201D of a current subtree using recursion...\n\tint Height(TreeNode* root) {\n        // Base case...\n\t\tif (root == NULL)  return 0;\n        // Height of left subtree...\n\t\tint leftHeight = Height(root->left);\n        // Height of height subtree...\n\t\tint rightHight = Height(root->right);\n        // In case of left subtree or right subtree unbalanced or their heights differ by more than \u20181\u2019, return -1...\n\t\tif (leftHeight == -1 || rightHight == -1 || abs(leftHeight - rightHight) > 1)  return -1;\n        // Otherwise, return the height of this subtree as max(leftHeight, rightHight) + 1...\n\t\treturn max(leftHeight, rightHight) + 1;\n    }\n};\n```\n\n# **Python Solution:**\n```\nclass Solution(object):\n    def isBalanced(self, root):\n        return (self.Height(root) >= 0)\n    def Height(self, root):\n        if root is None:  return 0\n        leftheight, rightheight = self.Height(root.left), self.Height(root.right)\n        if leftheight < 0 or rightheight < 0 or abs(leftheight - rightheight) > 1:  return -1\n        return max(leftheight, rightheight) + 1\n```\n            \n# **JavaScript Solution:**\n```\nvar isBalanced = function(root) {\n    // If the tree is empty, we can say it\u2019s balanced...\n    if (root == null)  return true;\n    // Height Function will return -1, when it\u2019s an unbalanced tree...\n\tif (Height(root) == -1)  return false;\n\treturn true;\n}\n// Create a function to return the \u201Cheight\u201D of a current subtree using recursion...\nvar Height = function(root) {\n    // Base case...\n\tif (root == null)  return 0;\n    // Height of left subtree...\n\tlet leftHeight = Height(root.left);\n    // Height of height subtree...\n\tlet rightHight = Height(root.right);\n    // In case of left subtree or right subtree unbalanced, return -1...\n\tif (leftHeight == -1 || rightHight == -1)  return -1;\n    // If their heights differ by more than \u20181\u2019, return -1...\n    if (Math.abs(leftHeight - rightHight) > 1)  return -1;\n    // Otherwise, return the height of this subtree as max(leftHeight, rightHight) + 1...\n\treturn Math.max(leftHeight, rightHight) + 1;\n};\n```\n\n# **Python3 Solution:**\n```\nclass Solution:\n    def isBalanced(self, root: Optional[TreeNode]) -> bool:\n        return (self.Height(root) >= 0)\n    def Height(self, root: Optional[TreeNode]) -> bool:\n        if root is None:  return 0\n        leftheight, rightheight = self.Height(root.left), self.Height(root.right)\n        if leftheight < 0 or rightheight < 0 or abs(leftheight - rightheight) > 1:  return -1\n        return max(leftheight, rightheight) + 1\n```\n**I am working hard for you guys...\nPlease upvote if you found any help with this code...**
['Recursion', 'C', 'Binary Tree', 'Python', 'Java', 'Python3', 'JavaScript']