牛客-二维数组中的查找
class Solution {
public:
bool Find(int target, vector<vector<int> > array) {
if (array.empty()) {
return false;
}
int col = array[0].size();
int row = array.size();
for (int i=0; i<row; i++) {
for (int j=col-1; j>=0; j--) {
if (target == array[i][j]) {
return true;
} else if (target>array[i][j]) {
break;
} else {
continue;
}
}
}
return false;
}
};