LLD - Design — Splitwise (Expense Sharing)Which data structure is most suitable for storing transaction history to allow fast retrieval by transaction ID?AQueueBLinked listCStackDHash map (dictionary)Check Answer
Step-by-Step SolutionSolution:Step 1: Consider retrieval speed by transaction IDFast lookup by ID requires constant time access, which hash maps provide.Step 2: Compare with other data structuresLinked lists, stacks, and queues require linear search for ID lookup, which is slower.Final Answer:Hash map (dictionary) -> Option DQuick Check:Fast ID lookup = Hash map [OK]Quick Trick: Use hash maps for fast key-based retrieval [OK]Common Mistakes:Choosing linked list for fast lookupConfusing stack or queue with random accessIgnoring retrieval speed requirements
Master "Design — Splitwise (Expense Sharing)" in LLD9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepArchTryChallengeDesignRecallScale
More LLD Quizzes Advanced LLD Concepts - Thread safety in design - Quiz 13medium Design — Chess Game - Board and piece hierarchy - Quiz 12easy Design — Chess Game - Piece movement rules (polymorphism) - Quiz 11easy Design — Online Shopping Cart - Payment strategy pattern - Quiz 8hard Design — Online Shopping Cart - Inventory management - Quiz 15hard Design — Online Shopping Cart - Payment strategy pattern - Quiz 1easy Design — Online Shopping Cart - Notification on state change - Quiz 9hard Design — Splitwise (Expense Sharing) - User, Group, Expense classes - Quiz 7medium Design — Splitwise (Expense Sharing) - Balance calculation algorithm - Quiz 14medium Design — Splitwise (Expense Sharing) - User, Group, Expense classes - Quiz 3easy