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```\n/**\n * @param {number[][]} mat\n * @param {number} k\n * @return {boolean}\n */\nvar areSimilar = function (mat, k) {\n    //o(n * m) time | o(n) space    \n    const modifiedMat = [];\n\n    for (const arr of mat) modifiedMat.push([...arr]);\n\n    for (let i = 0, count = 0; i < modifiedMat.length; i++, count = 0) {\n        if (i % 2 === 0) {\n            while (count < k) {\n                modifiedMat[i].push(modifiedMat[i].shift());\n                count++;\n            }\n        } else {\n            while (count < k) {\n                modifiedMat[i].unshift(modifiedMat[i].pop());\n                count++;\n            }\n        }\n    }\n\n    for (let i = 0; i < modifiedMat.length; i++) {\n        for (let j = 0; j < modifiedMat[i].length; j++) {\n            if (mat[i][j] !== modifiedMat[i][j]) return false;\n        }\n    }\n\n    return true;\n};\n```
['JavaScript']