input: Write a python function to generate all permutations of a list of numbers.
  assert permutations([1, 2]) == [[1, 2], [2, 1]]
  assert permutations([1, 2, 3]) == [[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]
  assert permutations([3]) == [[3]]
output: def permutations(nums):
      if len(nums) == 0:
          return [[]]
      elif len(nums) == 1:
          return [nums]
      else:
          result = []
          for i in range(len(nums)):
              current = nums[i]
              remaining = nums[:i] + nums[i+1:]
              for p in permutations(remaining):
                  result.append([current] + p)
          return result