✅ SINGLE ITERATION JAVA SOLUTION | EASY | JAVA
\npublic boolean areSimilar(int[][] mat, int k) {\n\tint r=mat.length, c=mat[0].length;\n\tfor(int i=0; i<r; i++){\n\t\tif(i%2 == 0){\n\t\t\tfor(int j=0; j<c; j
```\npublic boolean areSimilar(int[][] mat, int k) {\n\tint r=mat.length, c=mat[0].length;\n\tfor(int i=0; i<r; i++){\n\t\tif(i%2 == 0){\n\t\t\tfor(int j=0; j<c; j++){\n\t\t\t\tif(mat[i][j] != mat[i][(j+k)%c]) return false;\n\t\t\t}\n\t\t}else {\n\t\t\tfor(int j=c-1; j>=0; j--){\n\t\t\t\tif(mat[i][j] != mat[i][(j+k)%c]) return false;\n\t\t\t}\n\t\t}\n\t}\n\treturn true;\n}\n```
['Java']