I'm seeing the following error message in my solution to this Leetcode problem:
TypeError: object of type `NoneType' has no len()
for j in range(len(elt)+1)
class Solution:
def permute(self, nums: List[int]) -> List[List[int]]:
ans = [[]]
for i in range(len(nums)):
temp = []
for elt in ans:
for j in range(len(elt)+1):
local = elt.copy()
t = local.insert(j, nums[i])
temp.append(t)
ans = temp.copy()
return ans