首页 > 其他 > 详细

leetcode——240.搜索二维矩阵

时间:2019-09-29 16:30:56      阅读:104      评论:0      收藏:0      [点我收藏+]
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
执行用时 :48 ms, 在所有 Python3 提交中击败了96.07%的用户
内存消耗 :18.4 MB, 在所有 Python3 提交中击败了5.18%的用户
 
                                                                            ——2019.9.29
 
 

leetcode——240.搜索二维矩阵

原文:https://www.cnblogs.com/taoyuxin/p/11607709.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!