Solved LeetCode program · 832 of 1,000
#1103 · Distribute Candies to People
Original English source
The candies is 7. The people is 4. The shares is a list of 4 zeros. The given is 0. The turn is 1.
Repeat while candies is more than 0.
The person is given modulo people. The gift is turn. If gift is more than candies, set gift to candies. Increase item person of shares by gift. Subtract gift from candies. Add 1 to turn. Add 1 to given.
For each share in shares, show share.
Expected stdout
1 2 3 1