C++ BRUTE FORCE
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 
# 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```cpp []\nclass Solution {\npublic:\n    bool areSimilar(vector<vector<int>>& mat, int k) {\n        int n=mat.size();\n        int m=mat[0].size();\n        int x,y;\n        vector<vector<int>> matrix1(n,vector<int>(m,0));\n        vector<vector<int>> matrix2(n,vector<int>(m,0));\n        for(int i=0;i<n;i++){\n            for(int j=0;j<m;j++){\n                matrix2[i][j]=mat[i][j];\n            }\n        }\n        for(int i=0;i<n;i++){\n            for(int j=0;j<m;j++){\n                matrix1[i][j]=mat[i][j];\n            }\n        }\n        for(int i=1;i<=k;i++){\n            for(int j=0;j<n;j++){\n                if(j%2==0){\n                    y=0;\n                    for(int r=1;r<m;r++){\n                        matrix1[j][y]=mat[j][r];\n                        y++;\n                    }\n                    matrix1[j][y]=mat[j][0];\n                }else{\n                    y=1;\n                    for(int r=0;r<m-1;r++){\n                        matrix1[j][y]=mat[j][r];\n                        y++;\n                    }\n                    matrix1[j][0]=mat[j][m-1];\n                }\n            }\n            for(int i=0;i<n;i++){\n                for(int j=0;j<m;j++){\n                    mat[i][j]=matrix1[i][j];\n                }\n            }\n        }\n        if(matrix2==mat){\n            return true;\n        }else{\n            return false;\n        }\n    }\n};\n```
['C++']