Can we have a better solution
My solution for this problem is as follows:\n\n    public class Solution {\n    public boolean isBalanced(TreeNode root) {\n        if (root == null)\n         
My solution for this problem is as follows:\n\n    public class Solution {\n    public boolean isBalanced(TreeNode root) {\n        if (root == null)\n            return true;\n        if (Math.abs(depth(root.left) - depth(root.right)) >1)\n            return false;\n        return isBalanced(root.left) && isBalanced(root.right);\n    }\n    \n    private int depth(TreeNode root){\n        if (root == null)\n            return 0;\n        return Math.max(depth(root.left), depth(root.right)) + 1;\n    }\n}\n\nBut it has two recursions, one for depth() and one for isBalanced(). Will there be a performance issue?
[]