Short and Simple TS Solution
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```\nfunction areSimilar(mat: number[][], k: number): boolean {\n    const m = mat.length\n    const n = mat[0].length\n    const copy = mat.map(x => x)\n    let y\n\n    for (let i = 0; i < m; i++) {\n        if (i % 2 === 1) {\n            y = -k % n;\n        } else {\n            y = k % n;\n        }\n\n        mat[i] = mat[i].slice(y).concat(mat[i].slice(0, y));\n    }\n\n    return JSON.stringify(mat) === JSON.stringify(copy);\n};\n```
['TypeScript']