function MinInRow(matrix) { const height = matrix[0].length; const width = matrix.length; console.log("Height: " + height + " Width: " + width) const minColumns = []; for (let row = 0; row < width; row++) { let rowMin = matrix[row][0]; for ( let col = 0; col < height; col++) { if (rowMin < matrix[row][col]) { console.log(rowMin, "Compared to: ", matrix[row][col]) console.log("Row Num: ", row) console.log("col Num: ", col) rowMin = rowMin; } else { rowMin = matrix[row][col] } } minColumns.push(rowMin) console.log(minColumns) } console.log("End") return minColumns; };

The Whole Lucky Numbers Kit and Kaboodle::

function luckyNumbers(matrix) { let luckyNum = []; let ArrayColumns = maxInColumns(matrix); let ArrayRows = minInRows(matrix); for (let i = 0; i < matrix.length; i++) { if(ArrayColumns.includes(ArrayRows[i])) { return ArrayRows[i]; } } }; function maxInColumns(matrix) { const height = matrix.length; const width = matrix[0].length; const maxColumns = []; for (let col = 0; col < width; col++){ let colMax = matrix[0][col]; for (let row = 1; row < height; row++) { if(matrix[row][col] > colMax) { colMax = matrix[row][col]; } } maxColumns.push(colMax); } return maxColumns; }; function minInRows(matrix) { const height = matrix[0].length; const width = matrix.length; const minColumns = []; for (let row = 0; row < width; row++) { let rowMin = matrix[row][0]; for ( let col = 0; col < height; col++) { if (rowMin < matrix[row][col]) { rowMin = rowMin; } else { rowMin = matrix[row][col] } } minColumns.push(rowMin) } return minColumns; }; matrix = [[ 5, 9, 21], [ 9, 19, 6], [12, 14, 15]] console.log(luckyNumbers(matrix)); // [12] matrix = [[ 5, 10, 8, 6], [10, 2, 7, 9], [21, 15, 19, 10]] console.log(luckyNumbers(matrix)); // [10]