摘要: 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].注意不能用n!来判断了,可以先排一下序,当序列逆序时结束。 1 class Solution { 2 public: 3 bool nextPermutation(vector &num) { 4 if... 阅读全文
posted @ 2014-03-29 14:23 Eason Liu 阅读(221) 评论(0) 推荐(0) 编辑
摘要: Given a collection of numbers, return all possible permutations.For example,[1,2,3]have the following permutations:[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2], and[3,2,1].与Next Permutation一样,n个元素的排列共有n!个,所以只要执行n!次next_permutation就行。 1 class Solution { 2 public: 3 bool nextPermutation(vector &num) { 阅读全文
posted @ 2014-03-29 14:16 Eason Liu 阅读(534) 评论(0) 推荐(0) 编辑
摘要: Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possibl... 阅读全文
posted @ 2014-03-29 13:34 Eason Liu 阅读(3900) 评论(0) 推荐(3) 编辑
摘要: 发现了一个很棒的vim配置方法,现在共享给大家。https://github.com/kepbod/ivimivim - The Vim Distribution of Xiao-Ou ZhangSee ivim's states on GitEgoInstallationManual InstallA Vim/MacVim/gVim with version higher than 7.3 has been installed on your computer, and back up your origin vim stuff;Install Vundle to install a 阅读全文
posted @ 2014-03-29 00:49 Eason Liu 阅读(637) 评论(0) 推荐(0) 编辑