版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_22795513/article/details/80663409
class Solution(object):
def maxDepth(self, root):
"""
:type root: TreeNode
:rtype: int
"""
if root == None:
return 0
else:
return 1+max(self.maxDepth(root.left),self.maxDepth(root.right))