items = c(2, 5, 10, 50, 100)
value = 999
change_making(items, value)
if (FALSE) {
solutions <- numeric(20)
for (m in 1:20) {
sol <- change_making(items, m)
solutions[m] <- sol$count
}
solutions
#> [1] 0 1 0 2 1 3 2 4 3 1 4 2 5 3 2 4 3 5 4 2
}
Run the code above in your browser using DataLab