I want to know whether my algorithm is correct

```
class Solution:
# @param root, a tree node
# @param sum, an integer
# @return a list of lists of integers
def __init__(self):
self.solution = []
def pathSum(self, root, sum, l=[]):
if root is None: return []
l.append(root.val)
if root.left is None and root.right is None and root.val == sum:
self.solution.append(l)
if root.left is not None:
self.pathSum(root.left, sum-root.val, l)
if root.right is not None:
self.pathSum(root.right, sum-root.val, l)
return self.solution
```