2946. Matrix Similarity After Cyclic Shifts
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
class Solution:
    def areSimilar(self, mat: List[List[int]], k: int) -> bool:
        def shift_left(row):
            return row[1:] + [row[0]]

        def shift_right(row):
            return [row[-1]] + row[:-1]

        m, n = len(mat), len(mat[0])
        original = [row[:] for row in mat]

        for _ in range(k):
            for i in range(m):
                if i % 2 == 0:
                    mat[i] = shift_left(mat[i])
                else:
                    mat[i] = shift_right(mat[i])

        return mat == original

```
['Python3']