1 public class Solution { 2 public boolean Find(int target, int [][] array) { 3 for (int i = 0; i < array.length-1; i ++) { 4 if (target >= array[i][0] || target < array[i+1][0]) { 5 for (int j = 0; j < array[i].length; j++) { 6 if (array[i][j] == target) { 7 return true; 8 } 9 } 10 } 11 } 12 13 // 第n行搜索 14 for(int j = 0; j < array[array.length-1].length; j ++) { 15 if (array[array.length-1][j] == target) { 16 return true; 17 } 18 } 19 20 return false; 21 22 } 23 }