110. Balanced Binary Tree

   /*
    * 110. Balanced Binary Tree
    * 2016-7-19 by Mingyang
    * 过于基本,不解释
    */
     public boolean isBalanced(TreeNode root) {
            if(root==null)
              return true;
            int left=depth(root.left);
            int right=depth(root.right);
            if(Math.abs(left-right)<=1){
                if(isBalanced(root.left)&&isBalanced(root.right))
                  return true;
            }
            return false;
        }
        public int depth(TreeNode root){
            if(root==null)
              return 0;
            return Math.max(depth(root.left),depth(root.right))+1;
        }
原文地址:https://www.cnblogs.com/zmyvszk/p/5504683.html