# leetcode之Maximum Depth of Binary Tree

# Definition for a binary tree node.
# class TreeNode(object):
#     def __init__(self, x):
#         self.val = x
#         self.left = None
#         self.right = None

class Solution(object):
def maxDepth(self, root):
"""
:type root: TreeNode
:rtype: int
"""
depth = 0
if root == None:
return 0
else:
return 1 + depth + max(self.maxDepth(root.right), self.maxDepth(root.left))

#### leetcode 104 Maximum Depth of Binary Tree二叉树求深度

2015-05-13 22:16:12

#### Maximum Depth of Binary Tree -- LeetCode

2014-02-22 03:34:51

#### 104. Maximum Depth of Binary Tree [easy] (Python)

2016-05-07 13:21:08

#### maximum-depth-of-binary-tree(二叉树的最大深度)

2016-09-07 20:55:45

#### 【LeetCode-面试算法经典-Java实现】【104-Maximum Depth of Binary Tree（二叉树的最大深度）】

2015-08-08 06:43:32

#### 【LeetCode】【Python题解】Single Number & Maximum Depth of Binary Tree

2014-07-20 13:18:24

#### LeetCode#104. 二叉树的最大深度

2018-07-02 15:31:24

#### LeetCode104——Maximum Depth of Binary Tree

2015-02-05 15:29:44

#### Given a binary tree, find its maximum depth.

2014-05-23 14:21:31

#### 104. Maximum Depth of Binary Tree的C++解法

2017-03-30 13:31:29