// write code here
int[] result = new int[2];
int row = 0;
int col = m - 1;
while(row < n && col >= 0) {
if(mat[row][col] == x) {
result[0] = row;
result[1] = col;
break;
}
if(x > mat[row][col]) {
row ++;
} else {
col --;
}
}
return result;
}
由于整个矩阵是从做到右,从上到下严格升序的,那么从右上角的数据开始比较,比当前数据大就向下,比当前数据小则向左,直到找到数据