Solución
JL@juanluisabreu_4c541ef6
·16/4/2026TypeScriptsolution.tsTypeScript
function maxProduct(nums: number[]): number {
// Tu código aquí
let numeroMayor = 0;
for(let i = 0; i < nums.length - 1; i++) {
let numero = nums[i];
for (let j = i +1; j <=(nums.length-i+1); j++) {
numeroMayor = (numero * nums[j]) > numeroMayor? (numero * nums[j]): numeroMayor;
}
}
return numeroMayor;
}
// No modificar: necesario para evaluar el resultado.
export { maxProduct };
0respuestas