【answer】
We want to take a digit in which the enumeration time.
The
1112233
for (int I = Start; I <= n-; I ++)
// where start-1 is the last position taken.
If i> start and num [i] == num [i -1].
So we should no longer take this num [i] a.
Because num certainly would have gone before [i-1] a. At this time, then take a num [i] words. The resulting solution and certainly
11 ***** as the
(i == start where it is obtained it can take 111 ****)
[Code]
class Solution {
public:
vector<vector<int>> ans;
void dfs(vector<int> &v,int start,vector<int> &temp){
ans.push_back(temp);
for (int i = start;i<(int)v.size();i++){
if (i>start && v[i]==v[i-1]) continue;
temp.push_back(v[i]);
dfs(v,i+1,temp);
temp.pop_back();
}
}
vector<vector<int>> subsetsWithDup(vector<int> v){
sort(v.begin(),v.end());
ans.clear();
vector<int> t;t.clear();
dfs(v,0,t);
return ans;
}
};