题解 | #二维数组中的查找#
二维数组中的查找
https://www.nowcoder.com/practice/abc3fe2ce8e146608e868a70efebf62e
#
# @param target int整型
# @param array int整型二维数组
# @return bool布尔型
#
class Solution:
def Find(self , target: int, array: List[List[int]]) -> bool:
# write code here
row = len(array) - 1
col = len(array[0]) - 1
i = 0
j = col
while i <= row and j>=0:
if target == array[i][j]:
return True
elif target > array[i][j]:
i += 1
else:
j -= 1
return False
