function rotate(matrix) { return matrix[0].map((col, i) => matrix.map((row) => row[i])) } function rotateAntiClockwise(matrix) { return matrix[0].map((col, i) => matrix.map((row) => row[i]).reverse()) }