class Solution(object):
def permute(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
Len=len(nums)
if Len==0:return []
if Len==1:return [nums]
if Len==2:return [[nums[0],nums[1]],[nums[1],nums[0]]]
ans=[]
for i in range(0,Len):
curC=nums[i]
nextS=nums[:i]
nextS.extend(nums[i+1:])
returnS=self.permute(nextS)
for j in returnS:
curList=[curC]
curList.extend(j)
ans.append(curList)
return ans