Net Interbank Obligations Into the Fewest Settlement Transfers
Last updated: November 29, 2026
Quick Overview
Given a list of obligations (payer, payee, amount) among participants at end of day, compute the minimum number of transfers that settles every participant's net position.
Wells Fargo
November 29, 20260
0
0 solved
Given a list of obligations (payer, payee, amount) among participants at end of day, compute the minimum number of transfers that settles every participant's net position.
Clearing and settlement teams net many gross payments into a few transfers to cut liquidity needs and wire fees, which matters for a bank that settles across correspondents and clearing houses. The interviewer checks that you reduce to net balances, see why greedy matching is not optimal, and can build an exponential but well pruned exact solution for small groups.
What the Interviewer Expects
- Reduce gross obligations to net balances and drop zeros
- Observe that a zero-sum group of k participants needs exactly k-1 transfers
- Maximize the number of disjoint zero-sum groups via bitmask DP over subsets
- Give complexity O(3^n) and state the practical limit on n
- Explain why greedy largest-debtor-to-largest-creditor can be suboptimal
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you also output the actual transfers, not just the count?
- Participants number in the hundreds. What heuristic would you use, and how good is it?
- How does the objective change if you minimize total amount moved instead of count?
- How do liquidity limits or bilateral credit caps change the problem?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Amounts are integer cents. Output is the minimum number of transfers. Anyone with a zero net position is ignored. Any transfer can go between any two participants (no corridor limits in the base versi...
High-Level Design
Compute net = received minus paid. Let there be nonzero balances. Any settlement plan splits participants into groups that settle among themselves; a connected group of size needs at least $k-...