Tap here to switch tabs
Problem
Submissions

Problem: Matrix Similarity After Cyclic Shifts

med
30 min
Try to solve the Matrix Similarity After Cyclic Shifts problem.

Statement

You are given an m×nm \times n integer matrix mat and an integer k.

In one cyclic shift:

  • Rows at even indices are cyclically shifted to the left by 11 position.

  • Rows at odd indices are cyclically shifted to the right by 11 position.

After repeating this process k times on mat, return true if the final matrix is identical to the original matrix mat, and false otherwise.

Constraints:

  • 1≤1 \leq mat.length ≤25\leq 25

  • 1≤1 \leq mat[i].length ≤25\leq 25

  • 1≤1 \leq mat[i][j] ≤25\leq 25

  • 1≤1 \leq k ≤50\leq 50

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Matrix Similarity After Cyclic Shifts

med
30 min
Try to solve the Matrix Similarity After Cyclic Shifts problem.

Statement

You are given an m×nm \times n integer matrix mat and an integer k.

In one cyclic shift:

  • Rows at even indices are cyclically shifted to the left by 11 position.

  • Rows at odd indices are cyclically shifted to the right by 11 position.

After repeating this process k times on mat, return true if the final matrix is identical to the original matrix mat, and false otherwise.

Constraints:

  • 1≤1 \leq mat.length ≤25\leq 25

  • 1≤1 \leq mat[i].length ≤25\leq 25

  • 1≤1 \leq mat[i][j] ≤25\leq 25

  • 1≤1 \leq k ≤50\leq 50