标签:item 排序 和为s的两个数字 python for循环 2-2 描述 等于 col
对应每个测试案例,输出两个数,小的先输出。
方法一:两层for循环,得到的就是乘积最小的
1 class Solution: 2 def FindNumbersWithSum(self, array, tsum): 3 # write code here 4 for i in range(0,len(array)-1): 5 for j in range(1,len(array)): 6 if array[i]+array[j] == tsum: 7 return array[i],array[j] 8 return []
2019-12-25 19:07:51
标签:item 排序 和为s的两个数字 python for循环 2-2 描述 等于 col
原文地址:https://www.cnblogs.com/NPC-assange/p/12098471.html