标签:style blog color io ar div sp log on
public class Solution { public boolean searchMatrix(int[][] matrix, int target) { int low=0, high=matrix.length-1; while (low<high) { int mid = (low+high)/2+1; if (matrix[mid][0] > target) high = mid-1; else low = mid; } int index1 = low; low = 0; high = matrix[0].length-1; while (low<high) { int mid = (low+high)/2+1; if (matrix[index1][mid] > target) high = mid-1; else low = mid; } return matrix[index1][low] == target; } }
标签:style blog color io ar div sp log on
原文地址:http://www.cnblogs.com/yuhaos/p/3960972.html