function rotate_left_by_one(arr) {
const arr_size = arr.length;
const first = arr[0];
for (let i = 0; i < arr_size - 1; i++) {
arr[i] = arr[i + 1];
}
arr[arr_size - 1] = first;
}
function compare_rows(matrix, row1, row2) {
const cols = matrix[0].length
for (let j = 0; j < cols; j++) {
if (matrix[row1][j] != matrix[row2][j]) {
return false;
}
}
return true;
}
const matrix = [ [ 4, 7, 9, 18],
[ 7, 9, 18, 4],
[-9, -4, -3, 2],
[-8, -3, -9, 4],
[ 2, 6, 7, 24] ];
rotate_left_by_one(matrix[0]);
if (compare_rows(matrix, 0, 1)) {
console.log("yes");
} else {
console.log("no");
}
/*
run:
"yes"
*/