public class Solution { public boolean Find(int target, int [][] array) { // 判断空数组 if(array == null || array.length == 0 || array[0].length == 0){ return false; } // 数组非空 int rows = array.length; int cols = array[0].length; int r = 0; int c = cols-1; while(r <= rows - 1 && c >= 0){ if(array[r][c] == target){ return true; } else if(array[r][c] > target){ c--; } else{ r++; } } return false; } }