class Solution {
public:
int max = 0;
void get(Node *node, int dep){
int i;
if(!node->children.size() && dep > max) {
max = dep;
}
for(i=0; i<node->children.size(); i++){
get(node->children[i], dep+1);
}
}
int maxDepth(Node* root) {
if(!root) return 0;
get(root, 1);
return max;
}
};