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