Design a Mobile Group Expense Splitter (Splitwise-Style)

Group expense apps (Splitwise, Tricount, SettleUp) sit at the intersection of social and financial. The interview tests whether you understand the math (n-way settlement), the data model (transaction graph), and the realities of multi-currency, offline edits, and asynchronous group dynamics.

Functional requirements

  • Add expenses with split rules (equal, by share, by exact amount)
  • Compute who owes whom
  • Suggest minimum-transaction settlement
  • Multi-currency with conversion
  • Group balances visible to all members
  • Settlement marked when paid

Architecture

Three modules: expense entry, balance calculation, sync.

Data model

Each expense:

  • ID, group, payer, amount, currency, date, description
  • Splits: list of (debtor, share)

Each settlement:

  • From, to, amount, date

Balance per pair: sum of expenses where I owe you minus sum I have settled.

Balance calculation

For a group of N people:

  1. Compute net balance per person (positive = owed, negative = owes)
  2. Pair max-creditor with max-debtor; settle min(their amounts)
  3. Repeat until balances are zero

This produces minimum number of transactions to settle. Standard textbook problem.

Multi-currency

Each expense has a native currency. Group has a primary currency. Display converts using exchange rate at time of expense.

Real-time rates from a service (open exchange rates, currencylayer). Cache rates per day.

Settlement is in real currency (USD, EUR, etc.) — track which currency was actually paid.

Offline editing

User adds expenses while offline. Sync later. Strategies:

  • Each expense has a local UUID + server ID after sync
  • Operations log: add expense, edit, delete
  • Server merges; conflicts are rare for additive operations
  • For edits: last-write-wins by sequence number

Multi-user sync

One user adds an expense; others see it on their devices. Push notifications wake the app; pull on foreground.

Common edge case: User A added an expense; User B edited it before A’s edit synced. Conflict resolution: surface to user, offer to merge.

Notifications

  • “Alex added a $50 expense for dinner”
  • “Sam paid Alex $30”
  • “You owe Alex $25 for the trip”

Cap frequency to avoid spam. Aggregate (“3 new expenses in your group”).

Privacy

  • Group members see all expenses in the group
  • Expenses outside the group are private
  • Sensitive descriptions (“medical bill”) may need extra discretion

Common gotchas

  • Floating-point arithmetic for money (use integer cents)
  • Rounding errors in equal splits ($10 / 3 = ?)
  • Currency conversion drift over time
  • Members joining mid-trip (their share starts when they join)

Frequently Asked Questions

How does Splitwise handle the rounding problem?

Distribute the rounding error to the payer or first member. Always sum-check that the total of splits equals the total expense.

Should expenses be editable forever?

Most apps allow edit until settlement. After settlement, edits create a new adjustment expense.

What about complex splits like “I had only the appetizer”?

Per-line-item splitting. Power-user feature; most apps support exact-amount or exact-shares as flexible enough.

Scroll to Top