class Solution {
public:
vector<vector<int>> subsets(vector<int>& nums)
{
vector<vector<int>> res;
vector<int> emp;
res.push_back(emp);
sort(nums.begin(), nums.end());
if(nums.size()==0)
return res;
for(vector<int>::iterator iter=nums.begin();iter!=nums.end();++iter)
{
int size=res.size();
for(int i=0;i<size;++i)
{
vector<int> temp=res[i];
temp.push_back(*iter);
res.push_back(temp);
}
}
return res;
}
};
http://www.cnblogs.com/felixfang/p/3775712.html
Subsets
最新推荐文章于 2019-06-11 10:20:00 发布