class Solution {
public:
vector<int> findElement(vector<vector<int> > mat, int n, int m, int x) {
// write code here
int i=0,j=m-1;
vector<int> ret;
while(i<n && j>=0) {
if(mat[i][j] == x) {
ret.push_back(i);
ret.push_back(j);
break;
}
else if(mat[i][j] > x) {
j--;
}
else {
i++;
}
}
return ret;
}
};</int></int></int>