Commit 40ef5d4

mo <mokha@cisco.com>
2017-05-15 15:08:49
rename other_index to complement
1 parent f646793
Changed files (1)
spec
spec/leetcode/1_two_sum_spec.rb
@@ -8,8 +8,8 @@ describe description do
   def two_sum(numbers, target:)
     items = {}
     numbers.each_with_index do |number, index|
-      if other_index = items[target - number]
-        return [index, other_index].sort
+      if complement = items[target - number]
+        return [index, complement].sort
       end
       items[number] = index
     end