There is a problem with question. It asks for combinations, but actually includes permutations.

For example, 1,3 and 3,1 are same combinations. The following code treats these as combination.

So the question should be rephrased either to permutuation or the answers should be corrected.

```
class Solution {
public:
int combinationSum4(vector<int>& nums, int target) {
vector<int> cur;
return comb(nums,cur, 0, target, 0);
}
int comb(vector<int>& nums, vector<int> cur, int cursum, int target, int sp)
{
if(cursum == target)
{
for( int i=0;i < cur.size();i++)
cout << cur[i];
cout<<endl;
return 1;
}
else if( sp == nums.size() || cursum >target)
return 0;
else
{
cur.push_back(nums[sp]);
int v= comb (nums, cur, nums[sp]+cursum , target, sp );
cur.erase(cur.end()-1);
v += comb(nums , cur, cursum, target, sp+1 );
//v+= comb (nums, nums[sp]+cursum , target, sp+1 );
return v;
}
}
};
```