':type root: TreeNode
:rtype: int'

def findBottomLeftValue(self, root):

    def findBottomLeftValueHelper(root, curr_depth, max_depth, bottom_left_value):
        if (not root):
            return (max_depth, bottom_left_value)
        if ((not root.left) and (not root.right) and ((curr_depth + 1) > max_depth)):
            return ((curr_depth + 1), root.val)
        (max_depth, bottom_left_value) = findBottomLeftValueHelper(root.left, (curr_depth + 1), max_depth, bottom_left_value)
        (max_depth, bottom_left_value) = findBottomLeftValueHelper(root.right, (curr_depth + 1), max_depth, bottom_left_value)
        return (max_depth, bottom_left_value)
    (result, max_depth) = (0, 0)
    return findBottomLeftValueHelper(root, 0, max_depth, result)[1]
