Preparing your design workspace

Loading the problem and your saved attempt…

Design and Implement a Shared Expense Tracker

Record group expenses, split amounts deterministically, and maintain auditable pairwise balances.

For this exercise, assume users belong to groups and record an expense with one payer, participants, currency, and either equal or exact shares. Monetary values use integer minor units; shares must sum exactly to the expense; a client retry with the same idempotency key must not apply balances twice.

The system returns immutable expense history and derived net balances, and a settlement records a transfer without rewriting prior expenses. Design the domain and repositories, then implement expense validation, deterministic equal-split remainder allocation, and balance updates with tests.

Exclude payment processing and foreign-exchange conversion.