Compute Minimal Settlement Transfers After Multilateral Netting

Last updated: November 29, 2026

Quick Overview

Given a list of interbank obligations (payer, payee, amount), compute each bank's net position and output a list of settlement transfers that clears every position using at most n minus 1 transfers.

Citi
Coding & Algorithms
Software Engineer
Citi
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Medium

0

0

0 solved


Given a list of interbank obligations (payer, payee, amount), compute each bank's net position and output a list of settlement transfers that clears every position using at most n minus 1 transfers.

Netting is how clearing systems such as CHIPS, which Citi's 24/7 USD clearing builds on, cut the liquidity banks need to settle. The interviewer looks for the insight that only net positions matter, a correct greedy settlement, and awareness that the truly minimal count is NP-hard.

What the Interviewer Expects
  • Collapse gross obligations into net positions per participant
  • Prove net positions sum to zero
  • Greedily match largest debtor with largest creditor
  • Bound the transfer count by n minus 1
  • Use integer amounts
  • Mention that the exact minimum is a subset-sum style hard problem
Key Topics to Cover
netting
greedy algorithms
heaps
clearing and settlement
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • Why is the exact minimum number of transfers NP-hard, and when would you still compute it?
  • How would you net per currency and then settle across currencies?
  • How does netting change intraday liquidity needs versus gross real-time settlement?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Input: (payer, payee, amount_cents) triples. Output: transfers (from, to, amount) such that after applying them every participant's net is zero. Aim for few transfers; guarantee at most n minus 1 ...

High-Level Design

Gross obligations are irrelevant once netted: bank A owing B 100 and B owing C 100 is the same as A owing C 100 for settlement purposes. So:

  1. Compute net[x] = received - paid. These sum to zero. 2...

Submit Your Answer
Markdown supported

Related Questions