```
class Solution:
# @param num, a list of integer
# @return a list of lists of integers
def permute(self, num):
result = [[]]
permutations = []
for i in num:
if result == [[]]:
result = [[i]]
else :
for j in result :
for k in range(0,len(j)+1) :
temp = j[:]
temp.insert(k,i)
permutations.append(temp)
result = permutations[:]
permutations = []
return result
```