classSolution(object): defpermute(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ if len(nums) <= 1: return [nums] solns = [] for i, num in enumerate(nums): for tail in self.permute(nums[:i] + nums[i+1:]): solns.append([num] + tail) return solns