"""
# Definition for a Node.
class Node(object):
def __init__(self, val, children):
self.val = val
self.children = children
"""
class Solution(object):
def maxDepth(self, root):
"""
:type root: Node
:rtype: int
"""
if not root:
return 0
if not root.children:
return 1
return 1 + max(list(map(self.maxDepth, root.children)))
leetcode559 Python3 128ms N叉树的最大深度
原文:https://www.cnblogs.com/theodoric008/p/9380391.html