public class Solution {
public int TreeDepth(TreeNode root) {
if(root == null){
return 0;
}
return Math.max(TreeDepth(root.left),TreeDepth(root.right))+1;
}
}二叉树的深度
最新推荐文章于 2025-12-15 18:00:16 发布
public class Solution {
public int TreeDepth(TreeNode root) {
if(root == null){
return 0;
}
return Math.max(TreeDepth(root.left),TreeDepth(root.right))+1;
}
}
2661
790

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