Find minimum number of coins that make a given value: Difference between revisions

m (→‎{{header|JavaScript}}: Used abs in test.)
Line 326:
const f = change([200, 100, 50, 20, 10, 5, 2, 1]);
 
return [1024, 988].mapreduce((acc, n) => {
const
report = f(n).mapreduce(
(a, [q, u]) => `${a}${q} * ${u}\n`,
) ""
.join("\n" );
 
return `${acc}Summing to ${abs(n)}:\n${report}`; + (
`${report}).join("\n\n");`
);
},
""
);
};
 
9,655

edits