Practice Matrix Similarity After Cyclic Shifts
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Repeat k steps on mat: shift every even-indexed row left by one position cyclically and every odd-indexed row right by one position cyclically. Return whether the final matrix equals the original matrix.
Source: Matrix Similarity After Cyclic Shifts on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
mat = [[1,2,3],[4,5,6],[7,8,9]], k = 4
Output
false
# Example 2
Input
mat = [[1,2,1,2],[5,5,5,5],[6,3,6,3]], k = 2
Output
true
# Example 3
Input
mat = [[2,2],[2,2]], k = 3
Output
true
Constraints
1 <= mat.length <= 25
1 <= mat[i].length <= 25
1 <= mat[i][j] <= 25
1 <= k <= 50
Related LeetCode Problems
Practice more problems similar to Matrix Similarity After Cyclic Shifts.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.