Clever problem simple solution
Intuition\nCyclic things are interesting. If k is 1, then every single element in the matrix must be identical. If k is 2, then every other element in each row 
# Intuition\nCyclic things are interesting. If `k` is `1`, then every single element in the matrix must be identical. If `k` is `2`, then every other element in each row must be identical. So, it really does not matter if it\'s shifting left or right. Each row must form a cyclic array.\n\nAll four of today\'s contest problems are clever. Good job, LeetCode!\n\n# Approach\nIt\'s not necessary to perform the real shifting. Simply check each row item\'s equality before and after the shift and return early if we find a conflict.\n\n# Complexity\n- Time complexity:\n$$O(mn)$$\n\n- Space complexity:\n$$O(1)$$\n\n# Code\n```cpp []\nbool areSimilar(vector<vector<int>>& mat, int k) {\n    int m = mat.size(), n = mat[0].size();\n    for (int i = 0; i < m; i++)\n        for (int j = 0; j < n; j++)\n            if (mat[i][j] != mat[i][(j + k) % n])\n                return false;\n    return true;\n}\n```
['C++']