← All problemsSign in

Equal Distribution

Nishu scored good marks in his previous test, so his mom gave him x candies. Now, he wants to distribute the candies amongst his n friends(including himself). He wants to distribute the candies equally for which he can either ask her mom for more candies or can return her extra candies. He will do this in such a way that the number of candies that he takes or returns to his mom is minimum. Can

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