题解 | #二维数组中的查找#
二维数组中的查找
https://www.nowcoder.com/practice/abc3fe2ce8e146608e868a70efebf62e
/**
* @author Lu.F
* @version 1.0
* @date 2022/10/14 8:51
*/
public class Solution1 {
public boolean Find(int target, int[][] array) {
// 第一长度
if (array.length == 0){
return false;
}
// 行
int row = array.length;
// 列
int column = array[0].length;
int r = row-1,l = 0;
while (r>=0 && l<column){
if (array[r][l]==target){
return true;
} else if (array[r][l]<target) {
l++;
}else {
r--;
}
}
return false;
}
}

