数组中查找给定值
程序员文章站
2022-05-18 17:15:26
...
def findk(m,k):
if m is None:
return False
r = 0
c = len(m[0])-1
while r<len(m[0]) and c>=0 andc<len(m):
print r,c
if m[r][c]==k:
return True
elif m[r][c]>k:
c -= 1
else:
r +=1
return False