題目描述:
求二叉樹的最大高度。
代碼實作:
public class Solution {
public int maxDepth(TreeNode root) {
if(root == null)
{
return ;
}
int left = , right = ;
left = maxDepth(root.left);
right = maxDepth(root.right);
return Math.max(left, right) + ;
}
}