class Solution: def searchMatrix(self, matrix, target): """ :type matrix: List[List[int]] :type target: int :rtype: bool """ #print(len(matrix))#行数 #print(matrix[0]) #print(len(matrix[0]))#列数 for i in range(len(matrix)): #print(matrix[i]) if target in matrix[i]: return True else: i+=1 else: return False
When execution: 48 ms, beat the 96.07% of users in all Python3 submission
Memory consumption: 18.4 MB, beat the 5.18% of users in all Python3 submission
——2019.9.29