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