
[英]TypeError: Argument of type 'NoneType' is not iterable in List comprehension
[英]TypeError: argument of type 'NoneType' is not iterable for list passed in as parameter to a function
給定一個由不同整數組成的數組,返回所有可能的排列。 您可以按任何順序返回答案。
我不斷收到錯誤,我不明白為什么。
TypeError: argument of type 'NoneType' is not iterable
if (nums[i] not in current):
這是我的代碼:
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.