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