📅  最后修改于: 2022-03-11 15:03:49.302000             🧑  作者: Mango
// transpone
const transpose = matrix => {
for (let row = 0; row < matrix.length; row++) {
for (let column = 0; column < row; column++) {
let temp = matrix[row][column]
matrix[row][column] = matrix[column][row]
matrix[column][row] = temp
}
}
return matrix;
}
// reverse
const reverse = matrix => matrix.map(row => row.reverse());
// rotate
const rotate = matrix => transpose(reverse(matrix));