[英]TypeError: argument of type 'NoneType' is not iterable for list passed in as parameter to a function
Given an array nums of distinct integers, return all the possible permutations.给定一个由不同整数组成的数组,返回所有可能的排列。 You can return the answer in any order.
您可以按任何顺序返回答案。
I keep getting the error, and I don't understand why.我不断收到错误,我不明白为什么。
TypeError: argument of type 'NoneType' is not iterable
if (nums[i] not in current):
This is my code:这是我的代码:
def permute(self, nums: List[int]) -> List[List[int]]:
output = []
self.backtracking(nums, output, [],0, len(nums))
return output
def backtracking(self, nums, outputList, current, length, maxLength):
if (length == maxLength):
outputList.append(current)
for i in nums:
if (nums[i] not in current):
self.backtracking(nums, outputList, current.append(nums[i]), length+1, maxLength)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.