JZ1 二维数组中的查找
![在这里插入图片描述](https://img-blog.csdnimg.cn/cc6a1c3f84ac4a3d880f78c1499f8deb.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyMTg3ODA5,size_16,color_FFFFFF,t_70)
通过右上角的数字去剔除行或列从而缩小范围
class Solution:
def Find(self, target, array):
l_row = len(array)
l_col = len(array[0])
i = 0
j = l_col-1
while i<l_row and j>=0:
if array[i][j] == target:
return True
if array[i][j] > target:
j -= 1
else:
i += 1
return False