Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Simple & Clear & Readable using map and indexOf solution in Clear category for [old] Weak Point by Rool_Kach
function weakPoint(data) {
const rowsSum = data.map(e=>e.reduce((a,c)=>a+c, 0));
const colsSum = data.map((e, col)=>e.reduce((a, c, row)=>a+data[row][col], 0));
const weakestRowIdx = rowsSum.indexOf(Math.min(...rowsSum));
const weakestColIdx = colsSum.indexOf(Math.min(...colsSum));
return [weakestRowIdx, weakestColIdx];
}
Jan. 26, 2019
Comments: