##Minimum Depth of Binary Tree
class Solution:
# @param root, a tree node
# @return an integer
def minDepth(self, root):
if not root:
return 0
if not root.left and root.right:
return self.minDepth(root.right) +1
if root.left and not root.right :
return self.minDepth(root.left) +1
return min(self.minDepth(root.left), self.minDepth(root.right)) +1