秒杀
/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution { public int maxDepth(TreeNode root) { if(root==null) return 0; int h1=maxDepth(root.left); int h2=maxDepth(root.right); return h1>h2?h1+1:h2+1; } }
树的最大深度 leecode java,布布扣,bubuko.com
原文地址:http://www.cnblogs.com/hansongjiang/p/3817214.html