题解 | #二维数组中的查找#利用二分法的方式
二维数组中的查找
http://www.nowcoder.com/practice/abc3fe2ce8e146608e868a70efebf62e
public class Solution {
public boolean Find(int target, int [][] array) {
for (int i=0;i<array.length;i++){
int head=0;
int Hend=array[i].length-1;
while (head<=Hend){
int middle=(head+Hend)/2;
if (array[i][middle]==target){
return true;
}else if(target>array[i][middle]){
head=middle+1;
}else {
Hend=middle-1;
}
}
}
return false;
}
}