← Questions
Transfers to bring every account up to a minimum balance
0
I was asked this
No reports yet. Sign in to say where you were asked it.
You hold money in several bank accounts, and every account must end with at least a minimum balance. Given each account's balance, return a list of transfers (from, to, amount) that achieves it, moving money from accounts above the minimum to accounts below it without pushing any donor under the minimum. Any working list is fine at first.
Follow-up: return the smallest possible number of transfers. Explain why greedy matching is not always optimal and how you would search for the minimum on a small number of accounts.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
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
