前序遍历保证取到的是最左边的节点加深度判断保证取到的是最深的
def findBottomLeftValue(self, root):
"""
:type root: TreeNode
:rtype: int
"""
self.depth = -1
def pre(root,cur):
if not root:
return 0
if self.depth < cur:
self.l = root.val
self.depth = cur
pre(root.left,cur+1)
pre(root.right,cur+1)
return self.l
return pre(root,0)