def depth(self,root):
if not root:return 0
return 1 + max(self.depth(root.left),self.depth(root.right))
求二叉树的深度
最新推荐文章于 2025-01-16 23:47:45 发布
def depth(self,root):
if not root:return 0
return 1 + max(self.depth(root.left),self.depth(root.right))

被折叠的 条评论
为什么被折叠?