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 叉树的最大深度
最新推荐文章于 2024-07-30 20:50:32 发布