1
var numSpecial = function (mat) {
2
function getColumnSum(colIdx) {
3
return mat.reduce((sum, row) => sum + row[colIdx], 0);
4
}
5

6
let special = 0;
7
for (let row of mat) {
8
if (row.reduce((acc, val) => acc + val, 0) === 1) {
9
const colIdx = row.indexOf(1);
10
special += getColumnSum(colIdx) === 1;
11
}
12
}
13

14
return special;
15
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0