#2946

Matrix Similarity After Cyclic Shifts

pupil · 405 · lc easy +24 · 59.4% accepted · 195 likes · top 57%

Description

Given an m x n matrix mat and integer k, apply k rounds of the following: cyclically shift even-indexed rows left and odd-indexed rows right.

Return true if the matrix looks the same as before the operations, false otherwise.

Code

1
2
3