码迷,mamicode.com
首页 >  
搜索关键字:permutate    ( 3个结果
LeetCode46:Permutations
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].全排列的问题,分析可以参考这篇文章这道题目的题解:c...
分类:其他好文   时间:2015-06-04 15:50:20    阅读次数:119
LeetCode47: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].这道题是打印一个整...
分类:其他好文   时间:2015-06-04 11:52:07    阅读次数:159
字母各异的全排列
def permutate(s): if not s: return [s] r = [] for i in range(len(s)): for m in permutate(s[:i] + s[i+1:]): r.append(s[i:i+1] + m) return r
分类:其他好文   时间:2015-02-25 15:21:42    阅读次数:102
3条  
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!