Step 1: Requirements
Requirements
Questions to ask the interviewer
- What split types — equal, exact amounts, percentage?
- Can one expense involve people from different groups?
- Do we need to simplify debts (minimize transactions)?
- Multi-currency support?
- Do we track who paid (could be split payers)?
- Expense history and undo?
Functional requirements
- Users can create groups and add members.
- Any member can add an expense, specifying who paid and how to split.
- Split strategies: equal, exact (specify each person's share), percentage.
- Track balances between every pair of users.
- Simplify debts: minimize the number of transactions to settle all balances.
- View balance summary per user and per group.
Non-functional requirements
- Balances must be consistent (no rounding drift).
- Extensible to new split types without changing core logic.
- Expense history is append-only (audit trail).
Assumptions
- Single currency.
- Single payer per expense (simplifies the model).
- No real payment integration — just balance tracking.