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