Python 3 Solution using list slicing
Intuition\n1. If k is equal number of columns then it is the same as the original matrix. So return True.\n2. After n rotations, since matrix return to its orig
# Intuition\n1. If k is equal number of columns then it is the same as the original matrix. So return True.\n2. After n rotations, since matrix return to its original position, we can divide k by n and just take the remainder using modulo (i.e. k = k % n)\n3. Construct a new matrix called newmat with the shifts and compare newmat with mat\n\n# Approach\nIterate through each row of the matrix mat and do the shifts to the left or right according to whether the row is even or odd.\nSo we go through the matrix just once to construct the new matrix after the shifts. Finally we compare the original matrix with the new matrix.\n\n# Complexity\n- Time complexity:\nO(n) -- linear time since we visit each element once\n\n- Space complexity:\nO(n) -- we construct a new matrix of the same size as the original matrix.\n\n# Code\n```\nclass Solution:\n    def areSimilar(self, mat: List[List[int]], k: int) -> bool:\n        if k == len(mat[0]):\n            return True\n           \n        m = len(mat)     # number of rows\n        n = len(mat[0])  # number of columns\n        k = k % n # after n rotations, matrix will come to its original position\n        newmat = []\n        for i in range(m):\n            if i % 2 == 0:  # odd index shift left\n                newmat.append(mat[i][k : n] + mat[i][0 : k])\n            else:  # even index shift right\n                newmat.append(mat[i][n - k : n] + mat[i][0 : n - k])\n\n        return mat == newmat\n```
['Python3']