class Solution {
public int maxDepth(Node root) {
if(root == null) return 0;
int res = 0;
for(Node i:root.children){
res = Math.max(maxDepth(i),res);
}
return res + 1;
}
}
559. N 叉树的最大深度
最新推荐文章于 2025-07-28 17:30:49 发布