(root, sum)
return has_path_sum(root.left, sum) or has_path_sum(root.right, sum)
:type root: TreeNode
    :type sum: int
    :rtype: bool
:type root: TreeNode
    :type sum: int
    :rtype: bool
: type root : TreeNode : type sum : int : rtype : bool
def has_path_sum(root, sum):
    """
    :type root: TreeNode
    :type sum: int
    :rtype: bool
    """
    if not root:
        return False
    if not root.left and not root.right and root.val == sum:
        return True
    sum -= root.val
    return has_path_sum(root.left, sum) or has_path_sum(root.right, sum)
def has_path_sum ( root , sum ) : if not root : return False if not root . left and not root . right and root . val == sum : return True sum -= root . val return has_path_sum ( root . left , sum ) or has_path_sum ( root . right , sum )