```
class Solution(object):
def permute(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
if nums == None or len(nums) <= 1:
return [nums]
res_lst = []
res = []
self.permuteHelper(res_lst, nums, res)
return res_lst
def permuteHelper(self, res_lst, nums, res):
if len(res) == len(nums):
res_lst.append(res)
return
for n in nums:
if n not in res:
self.permuteHelper(res_lst, nums,res+[n])
res = res[:-1] #Prune back one node
```