struct TreeNode
{
TreeNode* left;
TreeNode* right;
int value;
};
void pathSum(TreeNode* root, int gap, vector<int>& cur, vector< vector<int> >& res)
{
if (root == nullptr)
{
return;
}
cur.push_back(root->value);
if (root->left == nullptr && root->right == nullptr)
{
if (gap == root->value)
{
res.push_back(cur);
}
}
pathSum(root->left, gap - root->value, cur, res);
pathSum(root->right, gap - root->value, cur, res);
cur.pop_back();
}
vector< vector<int> > pathSum(TreeNode* root, int sum)
{
vector< vector<int> > res;
vector<int> cur;
pathSum(root, sum, cur, res);
return res;
}struct TreeNode
{
TreeNode* left;
TreeN