Design a Tiered Expiring Item Store
Last updated: August 10, 2026
Quick Overview
Design a tiered expiring item store that allows items to be stored and retrieved based on specific expiration and priority rules.
Optiver
August 10, 202613
0
168 solved
Design a tiered expiring item store that allows items to be stored and retrieved based on specific expiration and priority rules.
This question is typically asked during the technical screening round for software engineering roles at Optiver. The interviewer is evaluating the candidate's understanding of object-oriented design principles, their ability to implement a functional system, and their attention to detail in handling edge cases, such as expiration and item priority during retrieval.
What the Interviewer Expects
- Implement a class with an __init__ method to initialize the store.
- Create store and retrieve methods that adhere to the specified rules.
- Ensure retrieval prioritizes items based on weight and checks for expiration.
- Handle edge cases such as levels having less than 50% remaining items.
- Demonstrate clear and maintainable code with appropriate comments.
Key Topics to Cover
How to Approach This
- Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
- Choose data structures based on access patterns, not familiarity.
- Prefer immutable data and message passing over shared mutable state for concurrency.
- Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
- How would you modify the design to handle concurrent access?
- Can you explain how you would test this implementation?
- What changes would you make if the item attributes were to change frequently?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
To design a tiered expiring item store, we need to define the following requirements:
- Storage Structure: The store should be organized into tiers, where each tier can hold items that have a spe...
High-Level Design
The design will consist of a class TieredItemStore with the following methods:
__init__: Initializes the store with a defined number of tiers and their capacities.store(item): Adds an item ...