Producto acumulado
Crea una función que tome un arreglo y devuelva un arreglo con los productos acumulados.
Ejemplos
Program.accumulatingProduct(new int[]{1, 2, 3, 4}) ➞ new int[]{1, 2, 6, 24}
// La salida es [1, 1 × 2, 1 × 2 × 3, 1 × 2 × 3 × 4].
Program.accumulatingProduct(new int[]{1, 5, 7}) ➞ new int[]{1, 5, 35}
Program.accumulatingProduct(new int[]{1, 0, 1, 0}) ➞ new int[]{1, 0, 0, 0}
Program.accumulatingProduct(new int[0]) ➞ new int[0]Notas
- Un arreglo vacío devuelve un arreglo vacío.