/*
*/
class Solution {
public:
vector<int> findElement(vector<vector<int> > mat, int n, int m, int x) {
vector<int> ans;
if(n == 0 || m == 0) return ans;
int row = 0, col = m-1;
while( row < n && col >= 0){
if(mat[row][col] < x) row++;
else if(mat[row][col] > x) col--;
else {
ans.push_back(row);
ans.push_back(col);
return ans;
}
}
return ans;
}
};
京公网安备 11010502036488号