← All problemsSign in

An Apple a day

People in Foodia love apples. They are also very generous. Due to a famine, they now have only a limited supply of apples. Each person has an amount of apples, of which he eats one apple per day. As the people are very generous, they give apples to those in need. If a person runs out of apples, he can receive one apple from anyone on that day. If a person runs out of apples and no one can give him

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