classSolution:defpermute(self,nums: List[int]) -> List[List[int]]: res = []defbacktrack(curr):iflen(curr)==len(nums): res.append(list(curr))returnfor num in nums:if num in curr:continue curr.append(num)backtrack(curr) curr.pop()backtrack([])return res