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 40cc87c commit 58168e8Copy full SHA for 58168e8
src/test/java/com/thealgorithms/searches/TestSearchInARowAndColWiseSortedMatrix.java
@@ -0,0 +1,38 @@
1
+package com.thealgorithms.searches;
2
+
3
+import static org.junit.jupiter.api.Assertions.*;
4
+import org.junit.jupiter.api.Test;
5
6
+public class TestSearchInARowAndColWiseSortedMatrix {
7
+ @Test
8
+ public void searchItem() {
9
+ int[][] matrix = {
10
+ { 3, 4, 5, 6, 7 },
11
+ { 8, 9, 10, 11, 12 },
12
+ { 14, 15, 16, 17, 18 },
13
+ { 23, 24, 25, 26, 27 },
14
+ { 30, 31, 32, 33, 34 }
15
+ };
16
17
+ var test = new SearchInARowAndColWiseSortedMatrix();
18
+ int[] res = test.search(matrix, 16);
19
+ int[] expectedResult = { 2, 2 };
20
+ assertArrayEquals(expectedResult, res);
21
+ }
22
23
24
+ public void notFound() {
25
26
27
28
29
30
31
32
33
34
+ int[] res = test.search(matrix, 96);
35
+ int[] expectedResult = { -1, -1 };
36
37
38
+}
0 commit comments