leetcode——74.搜索二维矩阵
2020-02-06 18:45
148 查看
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]))#列数 if len(matrix)==1: if target in matrix[0]: return True else: return False for i in range(len(matrix)): #print(matrix[i]) if matrix[i][-1]<target: i+=1 else: if target in matrix[i]: return True else: return False
执行用时80ms
——2019.9.29
转载于:https://www.cnblogs.com/taoyuxin/p/11607721.html
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- leetcode-74 搜索二维矩阵
- LeetCode [74] 搜索二维矩阵
- LeetCode 74与240题:搜索二维矩阵
- leetcode的python实现 刷题笔记74:搜索二维矩阵(二分查找的思想)
- leetcode 240. 搜索二维矩阵 II
- LeetCode:搜索二维矩阵 II(Python版本)
- LeetCode刷题指南:搜索二维矩阵II
- LeetCode 74. 搜索二维矩阵
- Leetcode刷题26-240.搜索二维矩阵 II(C++)
- leetcode 刷题记录(高频算法面试题汇总) -- 搜索二维矩阵 ii
- leetCode 74.Search a 2D Matrix(搜索二维矩阵) 解题思路和方法
- leetcode-240 搜索二维矩阵
- Leet Code 74 Search a 2D Matrix - 搜索二维矩阵 - Java
- [LeetCode] Search a 2D Matrix 搜索一个二维矩阵
- leetCode 74.Search a 2D Matrix(搜索二维矩阵) 解题思路和方法
- LeetCode 240 搜索二维矩阵
- 【GO语言学习】LeetCode74. 搜索二维矩阵---二分法
- LeetCode240. 搜索二维矩阵 II(python)
- leetcode 74. 搜索二维矩阵
- LeetCode 240.搜索二维矩阵