2
* Definition for a binary tree node.7
* TreeNode() : val(0), left(nullptr), right(nullptr) {}8
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}9
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left),15
vector<vector<int>> v;16
void helper(vector<int> &t, int target, TreeNode *root) {20
if (root->left == NULL && root->right == NULL && target == root->val) {21
t.push_back(root->val);26
target = target - root->val;27
t.push_back(root->val);28
helper(t, target, root->left);29
helper(t, target, root->right);32
// cout<<root->val<<" "<<target<<endl;35
vector<vector<int>> pathSum(TreeNode *root, int targetSum) {37
helper(t, targetSum, root);