Expand description
§It Hangs in the Balance
To simplify things the solution assumes that the remaining items after the first best combination is found can be split evenly.
This problem is the same as Day 17 part two and we use the same dynamic programming approach
with two tables. This approach is described in detail in the day 17 solution.
The key difference is that we store the partial quantum entanglement as we build the table. If the number of items from a take/not take choice is fewer, then we just use that quantum entanglement. If the number of items is the same then we use the smaller value. Otherwise we do nothing.