Java solution based on height, check left and right node in every recursion to avoid further useless search
\n    public boolean isBalanced(TreeNode root) {\n        if(root==null){\n            return true;\n        }\n        return height(root)!=-1;\n        \n    
\n    public boolean isBalanced(TreeNode root) {\n        if(root==null){\n            return true;\n        }\n        return height(root)!=-1;\n        \n    }\n    public int height(TreeNode node){\n        if(node==null){\n            return 0;\n        }\n        int lH=height(node.left);\n        if(lH==-1){\n            return -1;\n        }\n        int rH=height(node.right);\n        if(rH==-1){\n            return -1;\n        }\n        if(lH-rH<-1 || lH-rH>1){\n            return -1;\n        }\n        return Math.max(lH,rH)+1;\n    }
[]