Algoritmos: Contar números negativos
const input = [ [-3, -2, -1, 1], [-2, 2, 3, 4], [4, 5, 7, 8] ] function countNegative(input) { let line = 0 let column = input[line].length - 1 let count = 0 while (line < input.length && column >= 0) { if (input[line][column] < 0) { count += column + 1 line++ } else { column-- } } console.log(input[line][column]) } countNegative(input[line][column])