Python. Just do the rotations
Intuition\nJust go row by row, rotate and check if the row is the same\n\n# Complexity\n- Time complexity: $O(n \cdot m)$\n\n# Code\n\nclass Solution:\n  def ar
# Intuition\nJust go row by row, rotate and check if the row is the same\n\n# Complexity\n- Time complexity: $O(n \\cdot m)$\n\n# Code\n```\nclass Solution:\n  def areSimilar(self, M: List[List[int]], k: int) -> bool:\n    k = k % len(M[0])\n    for i in range(len(M)):\n      tmp = list(M[i])\n      if i % 2 == 0:  # shift left\n        v1, v2 = tmp[:k], tmp[k:]\n        tmp = v2 + v1\n      else: # shift right\n        v1, v2 = tmp[:len(M[0]) - k], tmp[len(M[0]) - k:]\n        tmp = v2 + v1\n\n      if tmp != M[i]:\n        return False\n    \n    return True\n```
['Python3']