public class Solution {
public boolean Find(int target, int [][] array) {
int n = array.length;
int m = array[0].length;
int l = 0;
int r = m - 1;
for(int i = 0;i < n;i++){
l = 0;
r = m - 1;
while(l <= r){
int mid = l + (r - l) / 2;
if(array[i][mid] == target){
return true;
}else if(array[i][mid] > target){
r = mid - 1;
}else{
l = mid + 1;
}
}
}
return false;
}
}
public boolean Find(int target, int [][] array) {
int n = array.length;
int m = array[0].length;
int l = 0;
int r = m - 1;
for(int i = 0;i < n;i++){
l = 0;
r = m - 1;
while(l <= r){
int mid = l + (r - l) / 2;
if(array[i][mid] == target){
return true;
}else if(array[i][mid] > target){
r = mid - 1;
}else{
l = mid + 1;
}
}
}
return false;
}
}