mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-25 01:04:03 +08:00
psf/black code formatting (#1277)
This commit is contained in:

committed by
Christian Clauss

parent
07f04a2e55
commit
9eac17a408
@ -9,6 +9,8 @@ Given nums = [2, 7, 11, 15], target = 9,
|
||||
Because nums[0] + nums[1] = 2 + 7 = 9,
|
||||
return [0, 1].
|
||||
"""
|
||||
|
||||
|
||||
def twoSum(nums, target):
|
||||
"""
|
||||
:type nums: List[int]
|
||||
@ -17,11 +19,11 @@ def twoSum(nums, target):
|
||||
"""
|
||||
chk_map = {}
|
||||
for index, val in enumerate(nums):
|
||||
compl = target - val
|
||||
if compl in chk_map:
|
||||
indices = [chk_map[compl], index]
|
||||
print(indices)
|
||||
return [indices]
|
||||
else:
|
||||
chk_map[val] = index
|
||||
compl = target - val
|
||||
if compl in chk_map:
|
||||
indices = [chk_map[compl], index]
|
||||
print(indices)
|
||||
return [indices]
|
||||
else:
|
||||
chk_map[val] = index
|
||||
return False
|
||||
|
Reference in New Issue
Block a user