note:从最右上角开始。大于:row=row+1,小于:col = col-1
public class Solution {
public boolean Find(int target, int [][] array) {
// 获取数组的shape
int row = array.length-1;
int col = array[0].length-1;
int i = 0;
int j = col;
// 边界条件
while (i <= row & j >= 0){
if (target < array[i][j]){
j--;
}
else if (target > array[i][j]){
i++;
}
else{
return true;
}
}
return false;
}
}