https://blog.csdn.net/derrantcm/article/details/45330789
bool hasNum(int **num, int row, int col, int finder) {
if(NULL == num || 0 == row || 0 == col) {
return false;
}
int curRow = 0;
int curCol = col-1;
while (curCol >=0 && curRow < row) {
if(num[curRow][curCol] == finder) {
return true;
}
else if(num[curRow][curCol] > finder) {
curCol--;
}
else {
curRow++;
}
}
return false;
}
int *matrix[] =
{
(int[]){ 1, 4, 7, 11, 15 },
(int[]){ 2, 5, 8, 12, 19 },
(int[]){ 7, 8, 9, 16, 22 },
(int[]){ 10, 13, 14, 17, 24 },
(int[]){ 18, 21, 23, 26, 30 },
};
bool has = hasNum(matrix,5,5,3);
bool has1 = hasNum(matrix,5,5,6);
bool has2 = hasNum(matrix,5,5,11);