Bird
0
0

Given the net balances: Alice: +50, Bob: -30, Charlie: -20, what is the minimum number of transactions to settle debts using the simplify debts algorithm?

medium📝 Analysis Q13 of 15
LLD - Design — Splitwise (Expense Sharing)
Given the net balances: Alice: +50, Bob: -30, Charlie: -20, what is the minimum number of transactions to settle debts using the simplify debts algorithm?
A2 transactions
B3 transactions
C1 transaction
D4 transactions
Step-by-Step Solution
Solution:
  1. Step 1: Analyze net balances

    Alice is owed 50, Bob owes 30, Charlie owes 20.
  2. Step 2: Match debtors with creditor

    Bob pays Alice 30, Charlie pays Alice 20, totaling 2 transactions.
  3. Final Answer:

    2 transactions -> Option A
  4. Quick Check:

    Sum debts to creditor = 2 transactions [OK]
Quick Trick: Match debtors to creditors directly to minimize transactions [OK]
Common Mistakes:
  • Counting each debt separately without simplification
  • Assuming one transaction can cover all debts
  • Misallocating amounts between participants

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes