안녕하세요 강사님
function solution(arr) {
let answer = 0,
row = 0,
col = 0,
cro = 0,
rev = 0;
for (let k = 0; k < arr.length; k++) {
(row = 0), (col = 0);
for (let m = 0; m < arr.length; m++) {
row += arr[k][m];
col += arr[m][k];
}
cro += arr[k][k];
rev += arr[k][4 - k];
answer = Math.max(answer, row, col, cro, rev);
}
return answer;
}
이렇게 작성해봤습니다.