题目
C#代码
/**
* Definition for a binary tree node.
* public class TreeNode {
* public int val;
* public TreeNode left;
* public TreeNode right;
* public TreeNode(int x) { val = x; }
* }
*/
public class Solution {
public int MaxDepth(TreeNode root) {
if(root==null)
return 0;
int z=MaxDepth(root.left)+1;
int y=MaxDepth(root.right)+1;
return z>y?z:y;
}
}