小编Has*_*von的帖子

如何将列表中的两个数字相加?

python 3的解决方案是什么?

给定一个整数数组,返回两个数字的索引,使它们相加为特定目标。您可以假设每个输入都只有一个解决方案,并且您不能两次使用相同的元素。

例子:

Given nums = [2, 7, 11, 15], target = 9,
Because nums[0] + nums[1] = 2 + 7 = 9,
return [0, 1]. 
Run Code Online (Sandbox Code Playgroud)

python python-3.x

0
推荐指数
2
解决办法
2万
查看次数

标签 统计

python ×1

python-3.x ×1