题解 | #二维数组中的查找#
二维数组中的查找
https://www.nowcoder.com/practice/abc3fe2ce8e146608e868a70efebf62e
bool Find(int target, int** array, int arrayRowLen, int* arrayColLen) { // write code here int row = 0; int col = *arrayColLen - 1; while (row <arrayRowLen && col>=0) { if (target == array[row][col]) return 1; if (target < array[row][col]) col--; else //if (target > array[row][col]) row++; } return 0; }