题目标题

求数组中和为target的两个数:

难度:初级

数据分析
参考解析

def getRes_QuickSort(nums, target):
nums = sorted(nums)
len1 = len(nums)
res = []
if len1>= 2:
low, high = 0, len1-1
while low < high:
if nums[low] + nums[high] == target:
res.append((nums[low], nums[high]))
low += 1
high -= 1
elif nums[low] + nums[high] > target:
high -= 1
else:
low += 1
return res

if name == “main“:
nums = [int(i) for i in input().split()]
target = int(input())
print(getRes_QuickSort(nums, target))