转字我的OneNote笔记
代码
public class Solution {
public boolean Find(int target, int[][] array) {
for (int i = 0; i < array.length; i++) {
int low = 0;
int high = array[i].length - 1;
while (low <= high) {
int mid = (low + high) / 2;
if (target == array[i][high]) {
return true;
}
if (target < array[i][mid]) {
high = mid - 1;
continue;
} else if (target > array[i][mid]) {
low = mid;
high--;
continue;
} else if (target == array[i][mid]) {
return true;
}
if (low == mid) {
break;
}
}
}
return false;
}
}