Advent of Code: Day 17
No Such Thing as Too Much

First puzzle

This puzzle looks like a classic optimization problem. We have a set of buckets, and we need to find all the combinations where we could fit a volume of 150 liters. The solution is how many combination exists. On the example from the puzzle description, we have the following buckets: 20, 15, 10, 5 and 5 and we need to fit 25 liters. The combinations are:

In this example, the solution is 4.

The input parsing is minimum here, but there is some:

To find all the combinations we could a recursive function taking the first bucket and executing the function on the tail with a volume decrease of that bucket capacity:

Second puzzle

The second puzzle is to find all the combinations where the minimum number of buckets are used:

You can find this code along with my input and puzzle answers at here.

*****
Written by Darien Martinez on 17 March 2016