Split with friends (Expense Tracker)
Add shared expenses. split <amount <payer <name,name,… splits the amount equally (leftover cents go one each to the first names in the list) and prints split <amount paid by <payer among <n. settle prints the transfers that settle everyone: repeatedly the person who owes the most pays the person owed the most (ties by name), the smaller of the two amounts: <debtor pays <creditor <amount; with nothing owed print all settled. Settling clears the balances.
Input: As before.
Output: As before.
Difficulty: Hard. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.
Hint
- Balance = paid − owed for each person.