← Questions

Settle group trip expenses with the fewest transfers

0
GoogleCodingLast asked Nov 2025

Friends on a trip record payments: each record names the payer, the amount and the people it covered (the payer may be among them), split evenly. Compute each person's net balance, then return the fewest transfers that settle all debts, and the transfers themselves. Discuss greedy matching versus an exact search.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding