Subject: https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/submissions/
answer:
Binary tree traversal recursion
public int maxDepth(TreeNode root) {
if(root==null) {
return 0;
}else {
int heightLeft = 1+maxDepth(root.left);
int heightRight = 1+maxDepth(root.right);
return Math.max(heightLeft,heightRight);
}
}