LLD - Design — Splitwise (Expense Sharing)How would you design the Expense class to support splitting costs unevenly among users?AStore only total amount and divide equally in split methodBAdd a dictionary mapping users to their share amountsCAdd a list of users without share detailsDKeep a single user as payer and ignore othersCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand uneven split requirementUneven splits require tracking each user's specific share.Step 2: Choose data structure to map users to sharesA dictionary mapping users to amounts fits this need well.Final Answer:Add a dictionary mapping users to their share amounts -> Option BQuick Check:Uneven split needs user-to-share mapping [OK]Quick Trick: Use dictionary to map users to their shares [OK]Common Mistakes:Assuming equal split alwaysIgnoring share details per userUsing list without share info
Master "Design — Splitwise (Expense Sharing)" in LLD9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepArchTryChallengeDesignRecallScale
More LLD Quizzes Design — Chess Game - Board and piece hierarchy - Quiz 9hard Design — Chess Game - Board and piece hierarchy - Quiz 2easy Design — Hotel Booking System - Cancellation and refund policy - Quiz 15hard Design — Hotel Booking System - Search and filter design - Quiz 4medium Design — Hotel Booking System - Why booking tests availability and concurrency - Quiz 7medium Design — Hotel Booking System - Booking conflict resolution - Quiz 1easy Design — Online Shopping Cart - Notification on state change - Quiz 15hard Design — Online Shopping Cart - Notification on state change - Quiz 12easy Design — Splitwise (Expense Sharing) - Simplify debts algorithm - Quiz 15hard Design — Splitwise (Expense Sharing) - Split strategies (equal, exact, percentage) - Quiz 7medium