diff --git a/java8/src/main/java/com/shekhargulati/leetcode/algorithms/Problem01.java b/java8/src/main/java/com/shekhargulati/leetcode/algorithms/Problem01.java index e80ee0e..c3f4af6 100644 --- a/java8/src/main/java/com/shekhargulati/leetcode/algorithms/Problem01.java +++ b/java8/src/main/java/com/shekhargulati/leetcode/algorithms/Problem01.java @@ -54,7 +54,7 @@ public static int[] twoSum_binarySearch(int[] numbers, int target) { 3. If second number is found then return index of first and second and second else move to the next number. */ for (int i = 0; i < numbers.length; i++) { - int first = numbers[0]; + int first = numbers[i]; if (first < target) { int second = target - first; int secondElementIndex = Arrays.binarySearch(numbers, second);