Chinaunix首页 | 论坛 | 博客
  • 博客访问: 40221
  • 博文数量: 37
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 372
  • 用 户 组: 普通用户
  • 注册时间: 2013-10-12 23:27
文章分类

全部博文(37)

文章存档

2014年(5)

2013年(32)

我的朋友

分类: C/C++

2013-12-25 23:46:36

不写两个汉字貌似容易被CU识别为advertising...  that's why i am here...


点击(此处)折叠或打开

  1. class Solution {
  2. public:
  3.     vector<vector<int> > subsetsWithDup(vector<int> &S) {
  4.         vector<vector<int> > re;
  5.         if(S.empty()) return re;
  6.         vector<int> tmp;
  7.         re.push_back(tmp);
  8.         sort(S.begin(),S.end());
  9.         for(int i=0;i<S.size();i++)
  10.         {
  11.             int size=re.size();
  12.             for(int j=0;j<size;j++)
  13.             {
  14.                 tmp=re[j];
  15.                 tmp.push_back(S[i]);
  16.                 if(re.end()==find(re.begin(),re.end(),tmp)) re.push_back(tmp);
  17.             }
  18.         }
  19.         return re;
  20.     }
  21. };




阅读(138) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~