题解 | #二维数组中的查找#
二维数组中的查找
https://www.nowcoder.com/practice/abc3fe2ce8e146608e868a70efebf62e
# move the location from the top right or bottom left and move one step a time class Solution: def Find(self , target: int, array: List[List[int]]) -> bool: # write code here m = len(array) n = len(array[0]) irow, icol = 0, n - 1 while irow <= m - 1 and icol >= 0: cur_val = array[irow][icol] if cur_val == target: return True elif cur_val > target: icol -= 1 else: irow += 1 return False