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

m
m (→‎{{header|JavaScript}}: Additional comment line.)
Line 305:
() => {
const [h, ...t] = denominations;
const [q, r] = quotRemMath.trunc(m)( / h);
 
return (
Line 311:
[q, h]
] : []
).concat(change(t)(rm % h));
}
)() : [];
Line 346:
-x
) : x;
 
 
// quotRem :: Integral a => a -> a -> (a, a)
const quotRem = m =>
// The quotient, tupled with the remainder.
n => [Math.trunc(m / n), m % n];
 
 
9,655

edits