*此代码描述了如何在矩阵中查找幸运数字。 *
const luckyNumber = (矩阵)=>{
让 num = []
for (让 i = 0; i
让 arr = 矩阵[i];
让 rowMax = Math.min(…arr);
让columnIndex = 矩阵[i].indexOf(rowMax);
let column = matrix.map((row) => row[columnIndex]);
让columnMax = Math.max(…column);
if (rowMax === columnMax) {
num.push(rowMax);
}
}
返回数字;
}