-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSearchMatrixIITest.java
More file actions
35 lines (32 loc) · 856 Bytes
/
SearchMatrixIITest.java
File metadata and controls
35 lines (32 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import org.junit.Test;
public class SearchMatrixIITest {
SearchMatrixII solver = new SearchMatrixII();
@Test
public void test1(){
int[][] matrix = {
{1,4,7,11,15},
{2,5,8,12,19},
{3,6,9,16,22},
{10,13,14,17,24},
{18,21,23,26,30}
};
int target = 5;
boolean res = solver.searchMatrix(matrix, target);
System.out.println(res);
// true
}
@Test
public void test2(){
int[][] matrix = {
{1,4,7,11,15},
{2,5,8,12,19},
{3,6,9,16,22},
{10,13,14,17,24},
{18,21,23,26,30}
};
int traget = 20;
boolean res = solver.searchMatrix(matrix, traget);
System.out.println(res);
// false
}
}