Author: linkjob. Date 2026-11-05 15:45:57, views: 7, Raw

Увеличить
# Maximum Depth of N-ary Tree (LeetCode 559)

DFS depth over children.
 
```python
def maxDepth(root):
    if not root: return 0
    if not root.children: return 1
    return 1 + max(maxDepth(c) for c in root.children)
```
 
See [AI interview assistant](https://www.linkjob.ai/interview-copilot/).
 
(Affiliation: I work on Linkjob AI.)