Video Explanation Solution easy to understand | Programming with Pirai | Half Moon Coder.
Video : https://youtu.be/Y6DrgcgZqMo\n\n# Code\npython3 []\nclass Solution:\n    def areSimilar(self, mat: List[List[int]], k: int) -> bool:\n        # n,m=len(
# Video : https://youtu.be/Y6DrgcgZqMo\n\n# Code\n```python3 []\nclass Solution:\n    def areSimilar(self, mat: List[List[int]], k: int) -> bool:\n        # n,m=len(mat),len(mat[0])\n        # k=k%m\n        # for i in range(n):\n        #     for j in range(m):\n        #         if i%2==0:\n        #             ind=(k+j)%m\n        #         else:\n        #             ind=(m+j-k)%m\n        #         if mat[i][j]!=mat[i][ind]:\n        #             return False\n        # return True\n\n        n,m=len(mat),len(mat[0])\n        k=k%m\n        for i in range(n):\n            for j in range(m):\n                ind=(k+j+m)%m\n                if mat[i][j]!=mat[i][ind]:\n                    return False\n            k*=-1\n        return True\n```
['Array', 'Math', 'Matrix', 'Simulation', 'Python3']