You are given the root of a binary tree and a number targetSum. Find every path that starts at the root, ends at a leaf, and has values that add up to targetSum. Return the paths as lists of node values.
A leaf is a node that has no children. Return the answer in any order.
Return a list of paths, and each path is a list of numbers.
How the judge passes the data
Examples
Example 1:
Input: root = [8,3,5,4,null,2,6], targetSum = 15
Output: [[8,3,4],[8,5,2]]
Explanation: Two paths add up to 15: 8 + 3 + 4 and 8 + 5 + 2.
Example 2:
Input: root = [1,2,3], targetSum = 9
Output: []
Explanation: No path adds up to 9.
Example 3:
Input: root = [1,2], targetSum = 1
Output: []
Explanation: The root alone has the sum 1, but the root is not a leaf here, because it has a child.