题目如下:
Given nums = [2, 7, 11, 15]
Target = 9
Return[i, j]
Code要怎么写:
def TwoSum(self, nums: List[int], target: int) -> List[int] :
for i in range():
for j in range(i+1,len(nums)):
if nums[i] +nums[j] == target:
return [i, j]
我觉得我会了
原文:https://www.cnblogs.com/hannahzhh/p/13200826.html