Shortest recursive solution
\n    public boolean isBalanced(TreeNode root) {\n        if(root==null) return true;\n        int l=depth(root.left);\n        int r=depth(root.right);\n      
\n    public boolean isBalanced(TreeNode root) {\n        if(root==null) return true;\n        int l=depth(root.left);\n        int r=depth(root.right);\n        return ((int)Math.abs(l-r)<2)&&isBalanced(root.left) && isBalanced(root.right);\n    }\n    static int depth(TreeNode n){\n            if(n==null) return 0;\n            return Math.max(depth(n.left),depth(n.right))+1;\n       }
['Recursion', 'Java']