A bit slow, but here is my solution using DFS:

```
def permute(nums):
stack = [([])]
res = []
while stack:
comb = stack.pop()
if len(comb) == len(nums):
res.append(comb)
continue
for n in range(0, len(nums)):
if nums[n] not in comb:
stack.append((comb + [nums[n]]))
return res
```

Any idea how to improve? Or should I avoid DFS for generating permutation?