559. N 叉树的最大深度c
/**
* Definition for a Node.
* struct Node {
* int val;
* int numChildren;
* struct Node** children;
* };
*/
int maxDepth(struct Node* root) {
if(!root) return 0;
int maxh=1;
for(int i=0;i<root->numChildren;i++){
int t=maxDepth(root->children[i])+1;
if(t>maxh) maxh=t;
}
return maxh;
}
DFS