diff --git a/TwoSum.java b/TwoSum.java index 81009de..a8114a7 100644 --- a/TwoSum.java +++ b/TwoSum.java @@ -27,9 +27,9 @@ public int[] twoSum(int[] numbers, int target) { for (int i = 0; i < numbers.length; ++i) { int b = target - numbers[i]; if (map.get(b) != null) { - return new int[]{map.get(b),i+1}; - } else map.put(numbers[i],i+1); + return new int[]{map.get(b),i}; + } else map.put(numbers[i],i); } return null; } -} \ No newline at end of file +}