Python求最大树深

本文阅读 0 分钟
首页 › Python笔记 › 正文
def maxDepth(root):
        if not root:
            return 0
        return max(maxDepth(root.left), maxDepth(root.right)) + 1
Python前中后序遍历
« 上一篇 04-10
Python求两棵树是否相同
下一篇 » 04-10

发表评论