Is there a path with this sum?
Write has_path_sum(root, target) that returns whether some path from the root to a leaf
has values adding up to target. An empty tree has no paths.
has_path_sum([5, 4, 8, 11, None, 13, 4, 7, 2, None, None, None, 1], 22) -> True (5+4+11+2)
has_path_sum([1, 2, 3], 5) -> False
has_path_sum(None, 0) -> False
The point is to practise passing a shrinking target down the recursion and recognising leaves.
def has_path_sum(root, target):
...