Problem 5
people are seated in a circle. A total of coins are distributed among them, not necessarily equally. A move transfers one coin between two adjacent people. Find an algorithm using the minimum number of moves that leaves everyone with the same number of coins.
Step 3 of 5: Choose a move decreasing
Detailed analysis
Take the first with . If the prefix is positive, transfer one coin from person to person ; its absolute value drops by one and no other term changes. If that prefix is not positive, minimality forces .