Straight forward python solution
\nclass Solution:\n    def areSimilar(self, mat, k: int):\n        import copy\n        ck = k\n        cmat = copy.deepcopy(mat)\n\n        m, n = len(mat), le
```\nclass Solution:\n    def areSimilar(self, mat, k: int):\n        import copy\n        ck = k\n        cmat = copy.deepcopy(mat)\n\n        m, n = len(mat), len(mat[0])\n\n        while k:\n            for i in range(m):\n\n                if i % 2 == 0:\n                    a = mat[i][0]\n                    for j in range(1,n):\n                        mat[i][j-1] = mat[i][j]\n                    mat[i][n-1] = a\n                else:\n                    a = mat[i][n-1]\n                    for j in range(n-1,0,-1):\n                        mat[i][j] = mat[i][j-1]\n                    mat[i][0] = a\n            k-= 1\n\n            if cmat == mat:\n                break\n\n        if k == 0 and cmat == mat:\n            return True\n        if k != 0 and cmat == mat and ck % (ck - k) == 0:\n            return True\n\n        return False \n```
['Python']