Skip to content

Commit d22420f

Browse files
authored
Fix off-by-one error (fixes TheAlgorithms#3248) (TheAlgorithms#3250)
1 parent 69d0070 commit d22420f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/main/java/com/thealgorithms/searches/BinarySearch.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class BinarySearch implements SearchAlgorithm {
3131
*/
3232
@Override
3333
public <T extends Comparable<T>> int find(T[] array, T key) {
34-
return search(array, key, 0, array.length);
34+
return search(array, key, 0, array.length - 1);
3535
}
3636

3737
/**

0 commit comments

Comments
 (0)