1. Every person's net balance = (what they paid) − (their share of everything) ± (payments already made).
2. People with a positive balance are owed money; negative balance owe money. All balances add up to exactly $0.00.
3. Take the biggest debtor and the biggest creditor, have the debtor pay the creditor as much as possible, then repeat. This needs at most N−1 = 2 payments for 3 people — the minimum possible. Splitting is done in whole cents, so nobody loses a penny to rounding.
Everything is saved on your device instantly and shared live with the other roommates once you are signed in with Google. Only the accounts on the access list can open the shared ledger.