Minimum additional jugs to buy for juice redistribution
Filed under Directi
The question
You start with N jugs each containing 1 liter of juice. You can pour the contents of one jug into another if they contain an equal amount of juice. You want to end up with no more than K non-empty jugs without wasting juice. You can buy additional 1-liter jugs. Find the minimum number of additional jugs you must buy to achieve this goal, or return -1 if impossible.
No write-up yet. Related questions below have one.
Related Directi questions
Collected from public candidate posts and coding forums. Updated Nov 2026.