Python 3 iterative and recursive solution
\nclass Solution_iterative_postorder:\n    def isBalanced(self, root):\n        stack = [(0, root)]\n        depth = {None: 0}\n        while stack:\n          
```\nclass Solution_iterative_postorder:\n    def isBalanced(self, root):\n        stack = [(0, root)]\n        depth = {None: 0}\n        while stack:\n            seen, node = stack.pop()\n            if node is None:\n                continue\n            if not seen:\n                stack.extend([(1, node), (0, node.right), (0, node.left)])\n            else:\n                if abs(depth[node.left] - depth[node.right]) > 1:\n                    return False\n                depth[node] = max(depth[node.left], depth[node.right]) + 1\n        return True\n\n\nclass Solution_recursive_without_extra_variable:\n    def isBalanced(self, root):\n        def dfs(root):\n            if root is None:\n                return 0\n            left = dfs(root.left)\n            right = dfs(root.right)\n            if left == -1 or right == -1 or abs(left - right) > 1:\n                return -1\n            return max(left, right) + 1\n        return dfs(root) != -1\n\n\nclass Solution_recursive_with_switch_variable:\n    def isBalanced(self, root):\n        """\n        :type root: TreeNode\n        :rtype: bool\n        """\n        self.switch = True\n\n        def dfs(root):\n            if root is None:\n                return 0\n            left = dfs(root.left)\n            right = dfs(root.right)\n            if abs(left - right) > 1:\n                self.switch = False\n            return max(left, right) + 1\n\n        dfs(root)\n        return self.switch\n```
[]