(int[][] matrix, int target)
| 1 | class Solution { |
| 2 | public boolean searchMatrix(int[][] matrix, int target) { |
| 3 | |
| 4 | if(matrix.length == 0 || matrix[0].length == 0){ |
| 5 | return false; |
| 6 | } |
| 7 | |
| 8 | if(matrix[matrix.length-1][matrix[0].length-1] < target){ |
| 9 | return false; |
| 10 | } |
| 11 | |
| 12 | for(int i=0; i<matrix.length; i++){ |
| 13 | for(int j=0; j<matrix[i].length; j++){ |
| 14 | |
| 15 | if(matrix[i][j] > target){ |
| 16 | return false; |
| 17 | } |
| 18 | else if(matrix[i][j] == target){ |
| 19 | return true; |
| 20 | } |
| 21 | else{ |
| 22 | continue; |
| 23 | } |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | return false; |
| 28 | } |
| 29 | } |
nothing calls this directly
no outgoing calls
no test coverage detected