二分
C++ 代码
class Solution {
public:
bool searchArray(vector<vector<int>> array, int target) {
int n = array.size();
if(n == 0) return false;
int m = array[0].size();
int i = 0, j = m - 1;
while(i < n && j >= 0){
if(array[i][j] == target) return true;
else if(array[i][j] > target) -- j;
else ++ i;
}
return false;
}
};