Who pays whom
In a group of three or more, Halvies works out the fewest payments that square everyone up. The person who owes the most pays the person owed the most, as much as one of them needs, and that repeats until everyone is at $0.00. It never takes more payments than one fewer than the number of people.
You are owed $637.80 and Sam $111.80; David owes $327.40 and Priya $422.20:
- Priya pays you $422.20
- David pays you $215.60
- David pays Sam $111.80
The suggestions are worked out again after every change, so a new expense can change who David is told to pay.