for loops
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python []\nclass Solution(object):\n    def areSimilar(self, mat, k):\n        \n        rows, cols = len(mat), len(mat[0])\n        original = [row[:] for row in mat]\n        while k>0:\n            matrixNew = [[0 for _ in range(len(mat[0]))] for _ in range(len(mat))]\n            for i,row in enumerate(mat):\n                for j,col in enumerate(row):\n                    if i%2==0:\n                        if j ==0:\n                             matrixNew[i][cols - 1] = row[0]\n                        else:\n                             matrixNew[i][j - 1] = row[j]\n                    else:\n                        if j ==cols-1:\n                             matrixNew[i][0] = row[cols - 1]\n                        else:\n                             matrixNew[i][j+1]= row[j]\n            mat = matrixNew                 \n            k-=1\n        return original == mat\n                        \n\n\n                \n```
['Python']