题目描述:
求二叉树的最大高度。
代码实现:
public class Solution {
public int maxDepth(TreeNode root) {
if(root == null)
{
return 0;
}
int left = 0, right = 0;
left = maxDepth(root.left);
right = maxDepth(root.right);
return Math.max(left, right) + 1;
}
}