← Remitly Interview Insights

Remitly·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Jun 2026

Summary

Remitly threw a classic debt-settlement problem at me, basically the same idea as LC 465. It was a coding round and the problem itself is well-known but getting to a minimum-transfer solution under pressure is a different thing.

Questions Asked (1)

Q1

Given a set of transactions or a map of accounts to net balances, write a function that produces the minimum number of transfers needed to settle all debts.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I knew this problem from practice so I wasn't totally lost, but minimum transfers is where I slowed down.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First compute each person's net balance by summing credits and debits, then use a greedy or backtracking algorithm to settle debts with the minimum number of transfers. Explain the trade-off between the optimal (exponential) backtracking solution and the efficient greedy heuristic, and justify your choice based on constraints.

Pro tip: Mention that the problem is NP-hard in general (minimum transactions is equivalent to partitioning), so interviewers often accept a greedy solution that is near-optimal; showing awareness of this trade-off demonstrates maturity.

1. Clarify input and output

Confirm the input format (list of transactions or map of accounts to net balances) and that the output should be a list of transfers (from, to, amount) that settles all debts.

2. Compute net balances

Iterate through transactions to calculate each person's net balance (positive means they are owed, negative means they owe). Filter out zero balances.

3. Choose settlement strategy

Decide between a greedy approach (repeatedly match the largest creditor with the largest debtor) and an optimal backtracking approach. Discuss time complexity and practical constraints.

4. Implement and test

Write the function, handle edge cases (no transactions, all zero balances), and walk through a small example to verify correctness.

5. Analyze complexity and trade-offs

State the time and space complexity of your solution and explain why the greedy approach may not always yield the absolute minimum but is efficient and often acceptable.

Key Points to Mention

  • Net balance calculation: sum of credits minus debits for each account.
  • Greedy algorithm: sort balances and repeatedly settle the largest debt with the largest credit.
  • Optimal solution via backtracking/DFS: exponential time, suitable only for small inputs.
  • NP-hardness: minimum transactions problem is equivalent to partitioning, so exact solution is impractical for large n.
  • Data structures: use arrays or priority queues to efficiently find max debtor/creditor.
  • Edge cases: zero balances, single transaction, already settled accounts.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.