Given the root of a binary tree and an integer targetSum, return all root-to-leaf paths where each path's node values sum to targetSum.
A leaf is a node with no children. Each returned path should list node values from root to leaf, in order.
Input / output
root: TreeNode, targetSum: int (JSON test fixture for root is a LeetCode-style level-order array, e.g. [5,4,8,11,null,13,4,7,2,null,null,5,1], with null for a missing child)int[][], one row per matching path, each row root-to-leaf in order (rows may appear in any order that matches a valid DFS traversal order)How would you adapt this to return the paths as soon as a match is found, without holding the full result set in memory at once?