标签:style blog color os io for ar div
描述:
输出全排列
代码:
1 class Solution: 2 # @param num, a list of integer 3 # @return a list of lists of integers 4 def doSth(self, num): 5 result = self.permute(num[1:]) 6 for lst in result: 7 for i in range(len(lst) + 1): 8 yield lst[:i] + num[:1] + lst[i:] 9 10 def permute(self, num): 11 if len(num) == 0: return [] 12 if len(num) == 1: return [num] 13 14 return list(self.doSth(num))
#Leet Code# Permutation,布布扣,bubuko.com
标签:style blog color os io for ar div
原文地址:http://www.cnblogs.com/mess4u/p/3904880.html