直接搜索,可以ac,后续再探索时间复杂度更小的方案
class Solution:
def Find(self , target: int, array: List[List[int]]) -> bool:
# write code here
m, n = len(array), len(array[0]) # 计算数组行数和列数
for i in range(m):
for j in range(n):
if array[i][j] == target:
return True
return False