Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
7
7_homework_yangpeng
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨鹏
7_homework_yangpeng
Commits
3c047376
Commit
3c047376
authored
Jan 20, 2019
by
yangpengflag
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update issue
parent
7a0a4e00
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
toeplitzmatrix.py
+3
-2
No files found.
toeplitzmatrix.py
View file @
3c047376
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment