给定一个二叉树,求它的深度
简单的递归就可以解决
public int depth(TreeNode root){ if(root==null) return 0; int left=depth(root.left); int right=depth(root.right); return Math.max(left,right)+1; }