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:MISTAKESAssuming 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 - Move validation and check detection - Quiz 5medium Design — Chess Game - Why chess tests polymorphism and strategy - Quiz 1easy Design — Food Delivery System - Why delivery systems test service coordination - Quiz 4medium Design — Food Delivery System - Delivery agent assignment - Quiz 4medium Design — Hotel Booking System - Room type hierarchy - Quiz 4medium Design — Online Shopping Cart - Product, Cart, Order classes - Quiz 7medium Design — Splitwise (Expense Sharing) - Balance calculation algorithm - Quiz 2easy Design — Splitwise (Expense Sharing) - Transaction history - Quiz 11easy Design — Splitwise (Expense Sharing) - Split strategies (equal, exact, percentage) - Quiz 10hard Design — Splitwise (Expense Sharing) - Balance calculation algorithm - Quiz 14medium