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 1 of 5: Encode the imbalance
Detailed analysis
Label people cyclically, let be the initial coin count, and set . Since the total is , . Relabel so that .