# -*- coding:utf-8 -*- class Solution: # array 二维列表 def Find(self, target, array): # write code here #方法二 从右上角开始进行搜索 if not array: return False rows = len(array) columns = len(array[0]) row = 0 column = columns - 1 while row < rows and column >= 0: if array[row][column] == target: return True if array[row][column] > target: column -= 1 else: row += 1 return False # 方法一 暴力搜索 for arr in array: if target in arr: return True return False