```
bool searchMatrix2(int** matrix, int matrixRowSize, int matrixColSize, int target) {
if(0==matrixRowSize) return false;
int p1=0;
int p2=matrixRowSize*matrixColSize;
while(p1<p2){
int mid = (p1+p2)/2;
int v=matrix[mid/matrixColSize][mid%matrixColSize];
if(v==target)
return true;
if(target>v){
p1=mid+1;
}else{
p2=mid;
}
}
return false;
}
```

well, the basic idea is to treat the 2d matrix as an array.