- [二叉树]111. Minimum Depth of Binar
- 二叉树的最小、最大深度以及平衡二叉树
- leetcode:111. Minimum Depth of B
- 111. Minimum Depth of Binary Tre
- 111. Minimum Depth of Binary Tre
- 111. Minimum Depth of Binary Tre
- 111. Minimum Depth of Binary Tre
- 111. Minimum Depth of Binary Tre
- 111. Minimum Depth of Binary Tre
- 111. Minimum Depth of Binary Tre

自己想一下递归过程,就知道怎么递推了
class Solution:
def minDepth(self, root):
"""
:type root: TreeNode
:rtype: int
"""
if not root: return 0
if not root.left and not root.right: return 1
if not root.left: return 1+self.minDepth(root.right)
if not root.right: return 1+self.minDepth(root.left)
return 1+min(self.minDepth(root.left), self.minDepth(root.right))
网友评论