← 返回 uber 的题目列表LLD: Build Splitwise (Write Running Code in 60 Minutes)
类型:online_judge
Design and implement a simplified Splitwise in 60 minutes (LLD with running code).
Build an expense-sharing system with:
Users identified by user id.
Add expense with payer, participants, total amount, and a split strategy.
Split strategies (at least):
Equal split among participants.
Weighted split given weights/shares per participant.
Balance tracking: maintain net debts between users (who owes whom and how much).
Queries:
Show all net balances for a given user.
Show all net balances in the system.
Constraints
Focus on runnable code, clean structure, extensibility (OOP modeling).
Specify how you handle money (cents vs decimals).
Handle invalid input (empty participants, invalid weights, etc.).
Example (illustrative)
A pays 90 for A/B/C equally → B owes A 30, C owes A 30.
B pays 40 for A/B with weights A:1, B:3 → A owes B 10.