Skip to content

Commit 2bee8b4

Browse files
authored
Create matrix-similarity-after-cyclic-shifts.py
1 parent 6b064d4 commit 2bee8b4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Time: O(m * n)
2+
# Space: O(1)
3+
4+
# array
5+
class Solution(object):
6+
def areSimilar(self, mat, k):
7+
"""
8+
:type mat: List[List[int]]
9+
:type k: int
10+
:rtype: bool
11+
"""
12+
return all(row[i] == row[(i+k)%len(row)]for row in mat for i in xrange(len(row)))

0 commit comments

Comments
 (0)