Back to DSA
Path Sum II
mediumGiven a binary tree and a target sum, enumerate all paths from the root to a leaf where the node values along the path add up exactly to the target. Return each qualifying path as a list of node values.
Examples
Example 1:
Input:
root = [10,5,15,3,7,null,20], targetSum = 18Output:
[[10,5,3]] Example 2:
Input:
root = [1,2,3], targetSum = 3Output:
[[1,2]]Hints
1234567