update 1
This commit is contained in:
parent
ee9d079d0b
commit
baab69d5a6
@ -11,23 +11,26 @@ class Solution:
|
|||||||
# both number in the list
|
# both number in the list
|
||||||
if another in nums:
|
if another in nums:
|
||||||
if nums[i] == another:
|
if nums[i] == another:
|
||||||
temp_list = nums
|
temp_list = nums.copy()
|
||||||
temp_list.pop(i)
|
temp_list.pop(i)
|
||||||
if another in temp_list:
|
if another in temp_list:
|
||||||
answer.append(i)
|
answer.append(i)
|
||||||
answer.append(temp_list.index(another) + 1)
|
answer.append(temp_list.index(another) + 1)
|
||||||
elif another not in temp_list:
|
return answer
|
||||||
|
|
||||||
|
if another not in temp_list:
|
||||||
continue
|
continue
|
||||||
answer.append(i)
|
answer.append(i)
|
||||||
answer.append(nums.index(another))
|
answer.append(nums.index(another))
|
||||||
|
print(nums)
|
||||||
|
print(another)
|
||||||
|
print(nums.index(another))
|
||||||
return answer
|
return answer
|
||||||
|
|
||||||
return answer
|
return answer
|
||||||
|
|
||||||
|
|
||||||
"""
|
test = [3, 2, 4]
|
||||||
test = [1, 2, 3]
|
TARGET_NUMBER = 6
|
||||||
TARGET_NUMBER = 3
|
|
||||||
a = Solution().twoSum(test, TARGET_NUMBER)
|
a = Solution().twoSum(test, TARGET_NUMBER)
|
||||||
print(a)
|
print(a)
|
||||||
"""
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user