## Base case

- This question wants to find a path from node to the
**leaf**, so the node who satisfies must be a **leaf** (`not node.left and not nood.right`

)
- I want to recursively subtract the
`sum`

by current node's value, so the leaf node of correct path must have the same value of its assigned `sum`

## Recursive step

- We want to traverse all the nodes, so
`node.left`

and `node.right`

must be called parallelly
- One valid path is enough, so we want to use
`or`

to connect two "branches"
- Considering each node as the root of its children,
`sum`

should be modified from its parent

```
def hasPathSum(self, root, sum):
if not root:
return False
if root.val == sum and not root.left and not root.right:
return True
return self.hasPathSum(root.left, sum - root.val) or \
self.hasPathSum(root.right, sum - root.val)
```