import itertools
class Solution:
    def permute(self, nums):
        """
        :type nums: List[int]
        :rtype: List[List[int]]
        """
        return list(itertools.permutations(nums))

s=Solution()
nums=[2,1,5,6,2,3]
print(s.permute(nums))
class Solution:
    def permute(self, nums):
        """
        :type nums: List[int]
        :rtype: List[List[int]]
        """
        self.ans=[]
        def helper(nums,path):
            if len(nums)==0:
                self.ans.append(path)
                return
            for i in range(len(nums)):
                helper(nums[:i]+nums[i+1:],path+[nums[i]])
        helper(nums,[])
        return self.ans