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