Commit 3c047376 by yangpengflag

update issue

parent 7a0a4e00
...@@ -6,7 +6,8 @@ class Solution: ...@@ -6,7 +6,8 @@ class Solution:
:type matrix: List[List[int]] :type matrix: List[List[int]]
:rtype: bool :rtype: bool
解题思路:遍历每一个元素,同时比较这个元素和它右下角元素的值是否相等,如果不相等,直接返回false,停止遍历 解题思路:遍历每一个元素,同时比较这个元素和它右下角元素的值是否相等,如果不相等,直接返回false,停止遍历,
需要注意的是,最后一行,每行最后一个元素不做比较,需要做循环控制
""" """
for i in range(len(matrix)-1): for i in range(len(matrix)-1):
...@@ -14,7 +15,7 @@ class Solution: ...@@ -14,7 +15,7 @@ class Solution:
if (matrix[i + 1][j + 1] != matrix[i][j]): if (matrix[i + 1][j + 1] != matrix[i][j]):
return False return False
return True return True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment