MAGIC BOXES
CodeChefOpen on judge ↗
Mehul is very fond of sweets. He has N boxes containing sweets. The first box contains 1 sweet, second box contains 2 sweets and so on... Seeing Mehul's love for sweets Fairy of SweetLand decides to reward him, she casts a magical spell of power K on his boxes. She now instructs him to transfer the sweets of first box to second and second to third and so on, until all the sweets are in the last
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.
Sign in to chat with the tutor and save your progress.
Sign in to start