Standard track invalid items
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
```csharp []
public class Solution {
    public bool AreSimilar(int[][] mat, int k) {
        int rows = mat.Length, cols = mat[0].Length;
        k %= cols;

        if(cols == 1 || k == 0)
            return true;

        // even rows: to right
        for(int i = 0; i < rows; i += 2)
        {
            for(int j = 0; j < cols; j++)
            {
                int nextId = (j+k)%cols;
                if(mat[i][j] != mat[i][nextId])
                    return false;
            }
        }

        // Odd rows: to left
        for(int i = 1; i < rows; i += 2)
        {
            for(int j = 0; j < cols; j++)
            {
                int nextId = (j+cols-k)%cols;
                if(mat[i][j] != mat[i][nextId])
                    return false;
            }
        }

        return true;
    }
}
```
['C#']