33/40
Part 7 of 7 · Follow-upsLearn
A budget instead of a count? One row per value of the budget
Minutes, money or weight work like the expert count: one row per value of the budget. That's what the worked example did with minutes.
When the budget is huge but only a few values are reachable, key a dict by the values that occur, instead of a list over all of them. Or swap what's stored and what's indexed: for each score, store the fewest minutes that reach it.