class Solution {
public int maxDepth(TreeNode root) {
if(root == null) return 0;
int left_h = maxDepth(root.left);
int right_h = maxDepth(root.right);
return Math.max(left_h,right_h) + 1;
}
}
104. 二叉树的最大深度
最新推荐文章于 2025-12-02 21:20:38 发布
472

被折叠的 条评论
为什么被折叠?



