题目要求:Permutations II

Given a collection of numbers that might contain duplicates, return all possible unique permutations.

For example,
[1,1,2] have the following unique permutations:
[1,1,2][1,2,1], and [2,1,1].

代码如下:

class Solution {
public:
vector<vector<int> > permuteUnique(vector<int> &num) { vector<vector<int>> result;
sort(num.begin(), num.end()); do{
result.push_back(num);
}while(next_permutation(num.begin(), num.end())); return result; }
};

最新文章

  1. T1加权像(T1 weighted image,T1WI)
  2. [No000024]鲜为人知的编程真相
  3. [JAVA] 一个可以编辑、编译、运行Java简单文件的记事本java实现
  4. 附加到iis进程调试时找不到w3wp.exe
  5. 【LeetCode】21. Merge Two Sorted Lists
  6. hdu 4081 最小生成树+树形dp
  7. intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
  8. VS2013以管理员身份使用
  9. 【多重背包模板】poj 1014
  10. druid查询
  11. Linux系列教程(二)——Linux系统安装(手把手学安装centos6.8)
  12. CommonJS,AMD,RequireJS的区别
  13. Linux下的 &gt;, &gt;&gt;, &lt;, ps, |, grep, /dev/null
  14. C语言第六周博客作业--数据类型
  15. Spring入门(一):创建Spring项目
  16. maven pom 属性介绍
  17. bootstrap的引用和注意事项
  18. vuex最简单的
  19. hibernate框架学习之持久化对象OID
  20. Hadoop-3.0.2 覆盖源代码生效

热门文章

  1. numpy基础读写
  2. 专业之旅——GitHub 热点速览 Vol.45
  3. Mongoose Guide(转)
  4. 【有奖众测】给HMS Core文档提建议,赢大奖华为Watch!
  5. 转载:Pycharm的常用快捷键
  6. WPF应用中一种比较完美的权限控制设计方式
  7. java小工具,使用Swing展示左树右表结构
  8. 小谢第58问:nuxt搭建企业官网
  9. PHP反序列化漏洞-CVE-2016-7124(绕过__wakeup)复现
  10. Codeforces741D