We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d2de400 commit 620f4aaCopy full SHA for 620f4aa
src/main/java/com/thealgorithms/others/TwoPointers.java
@@ -1,7 +1,5 @@
1
package com.thealgorithms.others;
2
3
-import java.util.Arrays;
4
-
5
/**
6
* The two-pointer technique is a useful tool to utilize when searching for
7
* pairs in a sorted array.
@@ -22,8 +20,8 @@ private TwoPointers() {
22
20
* @return {@code true} if there exists a pair of elements, {@code false} otherwise.
23
21
*/
24
public static boolean isPairedSum(int[] arr, int key) {
25
- int i = 0; // index of the first element
26
- int j = arr.length - 1; // index of the last element
+ int i = 0; // index of the first element
+ int j = arr.length - 1; // index of the last element
27
28
while (i < j) {
29
int sum = arr[i] + arr[j];
0 commit comments