← All problemsSign in

Minimum Bottles

CodeChefRating 656Open on judge ↗

There are $N$ identical water bottles, each of which has a capacity of $X$ liters. The $i^{th}$ bottle initially contains $A_i$ liters of water. You want to go on a trip and want to carry **all** your water with you. However, to not make packing a hassle, you also want to carry the least number of bottles with you. You can transfer any amount of water from one bottle to another, provided t

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start