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