3min,一次过
class Solution:
def maxDepth(self, root: TreeNode) -> int:
if not root:return 0
return max(self.maxDepth(root.left),self.maxDepth(root.right))+1
3min,一次过
class Solution:
def maxDepth(self, root: TreeNode) -> int:
if not root:return 0
return max(self.maxDepth(root.left),self.maxDepth(root.right))+1
本文标题:2019-08-24LeetCode104. 二叉树的最大深度
本文链接:https://www.haomeiwen.com/subject/yplqectx.html
网友评论