每行用二分法查找喵~
找到了就return True,没找到接着下一行找~
今天居然在python里面打出了{}!!我有罪!
class Solution:
def Find(self , target: int, array: List[List[int]]) -> bool:
# write code here
row=len(array)
col=len(array[0])
mid,flag=0,0
for i in range(row):
low,high=0,col-1
while low<=high:
mid=low+(high-low)//2
if array[i][mid]>target:
high=mid-1
elif array[i][mid]
方法2:java
public class Solution {
public boolean Find(int target, int [][] array) {
int row = array.length;
int col = array[0].length;
for (int i=0; itarget) high=mid-1;
else return true;
}
}
return false;
}
}



