class Solution {
public:
vector<int> findElement(vector<vector<int> >& mat, int n, int m, int x) {
vector<int> res(2);
for (int i = 0; i < n; i++) {
if(mat[i][0] <= x && mat[i][m -1] >= x){
for(int j = 0; j < m; j++){
if(mat[i][j] == x){
res[0] = i;
res[1] = j;
return res;
}
}
}
}
return res;
}
};

京公网安备 11010502036488号