#Combination Summ 2 Practice
void funct(int ind,int target,vector<int> st, vector<vector<int>> &v,vector<int>can)
{
if(target==0 )
{
v.push_back(st);
return;
}
for(int i=ind;i<can.size();i++)
{
if(i>ind && can[i]==can[i-1])
continue;
if(can[ind]<=target)
{
st.push_back(can[i]);
funct(i+1,target-can[i],st,v,can);
st.pop_back();
}
}
//funct(ind+1,target,st,v,can);
}
vector<vector<int>> combinationSum2(vector<int>& can, int target) {
vector<int> st;
vector<vector<int>> v;
sort(can.begin(),can.end());
funct(0,target,st,v,can);
return v;
}