|(require aoc-racket/day17)||package: aoc-racket|
This is a lot like the second part of Day 15, where we had to find cookie recipes that totaled 500 calories. This time, rather than recipes, we need to generate combinations of the containers that add up to exactly 150 liters (though we don’t have to use all the containers, and multiple containers of the same size are deemed to create unique arrangements).
We do this by creating the power set of the containers — that is, a list of all possible subsets — and counting how many meet our criterion. As with the recipe problem, our powerset function is a simple recursive operation.
Same as above, except we find the minimum length among the winners, and then count how many other winners have that length.