Java
class Solution {
public int maxDepth(TreeNode root) {
if(root==null)
return 0;
int res=1;
return res+Math.max(maxDepth(root.left),maxDepth(root.right));
}
}
class Solution {
public int maxDepth(TreeNode root) {
if(root==null)
return 0;
int res=1;
return res+Math.max(maxDepth(root.left),maxDepth(root.right));
}
}