def aa(nums,s): left,right=0,len(nums)-1 while left <right: if nums[left]+nums[right]==s: return [nums[left],nums[right]] elif nums[left]+nums[right]>s: right -=1 else : left +=1 return None print(aa([1,2,3,4,5],3))
def aa(nums,s): left,right=0,len(nums)-1 while left <right: if nums[left]+nums[right]==s: return [nums[left],nums[right]] elif nums[left]+nums[right]>s: right -=1 else : left +=1 return None print(aa([1,2,3,4,5],3))