Skip to content

Commit fc4d76d

Browse files
authored
Apply suggestions from code review
1 parent cd99c0f commit fc4d76d

File tree

2 files changed

+1
-18
lines changed

2 files changed

+1
-18
lines changed

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

-17
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,18 @@ public int[] search(int[][] matrix, int value) {
2020
int[] result = { -1, -1 };
2121

2222
while (i < n && j >= 0) {
23-
2423
if (matrix[i][j] == value) {
2524
result[0] = i;
2625
result[1] = j;
2726
return result;
2827
}
2928
if (value > matrix[i][j]) {
30-
3129
i++;
32-
3330
} else {
3431
j--;
3532
}
3633

3734
}
3835
return result;
3936
}
40-
41-
public static void main(String[] args) {
42-
int[][] matrix = {
43-
{ 3, 4, 5, 6, 7 },
44-
{ 8, 9, 10, 11, 12 },
45-
{ 14, 15, 16, 17, 18 },
46-
{ 23, 24, 25, 26, 27 },
47-
{ 30, 31, 32, 33, 34 }
48-
};
49-
50-
var search = new SearchInARowAndColWiseSortedMatrix();
51-
int[] res = search.search(matrix, 26);
52-
System.out.println(Arrays.toString(res));
53-
}
5437
}

src/test/java/com/thealgorithms/searches/TestSearchInARowAndColWiseSortedMatrix.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ public void notFound() {
3535
int[] expectedResult = { -1, -1 };
3636
assertArrayEquals(expectedResult, res);
3737
}
38-
}
38+
}

0 commit comments

Comments
 (0)