您的位置:首页 > 编程语言 > Python开发

leetcode之Search a 2D Matrix II

2015-10-21 00:20 696 查看
这个题目II和I对于python来说,都是一样的,代码都不用换。代码如下:

class Solution(object):
def searchMatrix(self, matrix, target):
"""
:type matrix: List[List[int]]
:type target: int
:rtype: bool
"""
list1 = []
for i in matrix:
list1.extend(i)
if target in list1:
return True
else:
return False
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  leetcode 2d matrix python