题解 | #二维数组中的查找#
二维数组中的查找
http://www.nowcoder.com/practice/abc3fe2ce8e146608e868a70efebf62e
public class Solution { public boolean Find(int target, int [][] array) { boolean Flag = false; if(array.length == 0||array[0].length == 0){ return Flag; } for(int i = 0;i<array.length;i++){ if(array[i][0]>target){ break; }else{ for(int j = 0;j<array[i].length;j++){ if(array[i][j] == target){ Flag = true; break; } if(array[i][j] >target){ break; } } } } return Flag; } }