【Leetcode】559. Maximum Depth of N-ary Tree

求N-叉樹的最大深度 方法1 有helper函數的遞歸 要注意遞歸停止的條件不是root==None,而是root 沒有孩子 class Solution1(object): def maxDepth(self, root): """ :type root: Node :rtype: int """ if root == None:
相關文章
相關標籤/搜索