class Solution:
def twoSum(self,nums, target):
thisdict = {}
#new_list = []
for i in range(0,len(nums)):
thisdict[nums[i]] = i
for i in thisdict:
rem = target - i
if rem in thisdict and rem != i:
return[thisdict[i],thisdict[rem] ]
a = Solution()
print(a.twoSum([3,3],6)) # It doesn't satisfy this use case
No comments:
Post a Comment