class Solution(object):

def permute(self, nums):

"""

:type nums: List[int]

:rtype: List[List[int]]

"""

answer = []

element = []

self.dfs(nums, element, answer)

return answer

```
def dfs(self, nums, element, answer): # without recording used numbers
if len(element) == len(nums):
answer.append(element[:])
return
else:
for j in range(len(nums)):
if nums[j] not in element:
element.append(nums[j])
else:
continue
self.dfs(nums,element,answer)
element.pop()
```