mirror of
https://github.com/TheAlgorithms/Ruby
synced 2024-12-26 21:58:56 +01:00
Minor fixes
This commit is contained in:
parent
471e6f9cd1
commit
16176d3936
1 changed files with 4 additions and 4 deletions
|
@ -28,7 +28,7 @@ def two_sum(numbers, target)
|
|||
elsif target > sum
|
||||
i += 1
|
||||
else
|
||||
return [i, j]
|
||||
return [i + 1, j + 1]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -36,14 +36,14 @@ end
|
|||
nums = [2, 7, 11, 15]
|
||||
target = 9
|
||||
print(two_sum(nums, target))
|
||||
# => [0,1]
|
||||
# => [1,2]
|
||||
|
||||
nums = [2, 3, 4]
|
||||
target = 6
|
||||
print(two_sum(nums, target))
|
||||
# => [0,2]
|
||||
# => [1,3]
|
||||
|
||||
nums = [-1, 0]
|
||||
target = -1
|
||||
print(two_sum(nums, target))
|
||||
# => [0,1]
|
||||
# => [1,2]
|
||||
|
|
Loading…
Reference in a new issue