From 16176d393651e97239d9c035ec8206bb2d7e1777 Mon Sep 17 00:00:00 2001 From: Vitor Oliveira Date: Thu, 11 Mar 2021 22:07:43 -0800 Subject: [PATCH] Minor fixes --- data_structures/arrays/two_sum_ii.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/data_structures/arrays/two_sum_ii.rb b/data_structures/arrays/two_sum_ii.rb index b966b6a..6e390b8 100644 --- a/data_structures/arrays/two_sum_ii.rb +++ b/data_structures/arrays/two_sum_ii.rb @@ -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]