(int matrix[],int target)
| 1 | class Solution { |
| 2 | public static boolean binSearch(int matrix[],int target) |
| 3 | { |
| 4 | int start=0,end=matrix.length-1; |
| 5 | while(start<=end) |
| 6 | { |
| 7 | int mid = start+(end-start)/2; |
| 8 | if(matrix[mid]==target) |
| 9 | return true; |
| 10 | else if(target<matrix[mid]) |
| 11 | { |
| 12 | end=mid-1; |
| 13 | } |
| 14 | else |
| 15 | start=mid+1; |
| 16 | } |
| 17 | return false; |
| 18 | } |
| 19 | public boolean searchMatrix(int[][] matrix, int target) { |
| 20 | |
| 21 | // Find the appropriate row |