class Solution:
def twoSum(self, nums: 'List[int]', target: 'int') -> 'List[int]':
dict_nums={}
for u,v in enumerate(nums):
dict_nums[u]=v
nums_sorted=sorted(nums)
length=len(nums)
for i in range(length-1):
for j in range(i+1,length):
if nums_sorted[i]+nums_sorted[j]>target:
break
elif nums_sorted[i]+nums_sorted[j]==target:
m=nums_sorted[i]
n=nums_sorted[j]
break
elif nums_sorted[i]+nums_sorted[j]<target:
continue
try:
if m:
break
except:
continue
rs1=[k for k,v in dict_nums.items() if v==m][0]
rs2=[k for k,v in dict_nums.items() if v==n and k!=rs1][0]
return [rs1, rs2]