原题链接:https://leetcode-cn.com/problems/er-cha-shu-zhong-he-wei-mou-yi-zhi-de-lu-jing-lcof/
vector<vector<int>> res;
vector<int> path;
vector<vector<int>> pathSum(TreeNode* root, int sum) {
recur(root, sum);
return res;
}
void recur(TreeNode* root, int target) {
if (root == NULL) return ;
path.push_back(root->val);
target -= root->val;
if (target == 0 && root->left == NULL && root->right == NULL) res.push_back(path);
recur(root->left, target);
recur(root->right, target);
path.pop_back();
}