////////// Exercice 1 ////////// ////////// Exercice 2 ////////// ////////// Exercice 3 ////////// function fact(n, p) { if (n <= 1n) return p; else return fact(n - 1n, n*p); } ////////// Exercice 4 ////////// // Return the price if any, otherwise 0 function getP(prices, i) { return (i < prices.length) ? prices[i] : 0; } maxGen((i) => i*i, -5, 5); // -> 25 maxGen((i) => i*i, 5, -5); // -> undefined cuttingStock([0, 1, 5, 8, 9, 10, 17],8); //-> 22 cuttingStock([0, 3, 5, 8, 9, 10, 17],8); //-> 24 const memo = { 0: 0 }; // i.e the cost for length 0 is 0