← All problemsSign in

The OCD Chocolate Box

Adam loves chocolates a lot, but his OCD forces him to store all the chocolates he receives in one box. He recently received N boxes, each with a random number of chocolates in each represented by Ci. He takes any two boxes, and combines the chocolates in them to a third empty box. He does this again and again till he is left with one box with all the chocolates. Assume Adam has all the empty box

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