件名:https : //leetcode-cn.com/problems/maximum-depth-of-binary-tree/submissions/
回答:
二分木探索再帰
public int maxDepth(TreeNode root){
if(root == null){
0を返します。
}そうしないと {
int heightLeft = 1 + maxDepth(root.left);
int heightRight = 1 + maxDepth(root.right);
Math.max(heightLeft、heightRight);を返します。
}
}