Design an in-memory hotel booking system
ImcSoftware Engineer · Technical ScreenLast updated
This question evaluates a candidate's ability to design in-memory data models, concurrency control mechanisms, and temporal reservation logic for booking systems.
Design a hotel booking system that supports reservations without using any database. You may only use in-memory data structures.
Requirements
Define APIs/data structures to support at least:
- Add hotels, room types, and room inventory (or individual rooms)
- Search availability for a date range (check-in, check-out)
- Create a booking (reserve room(s))
- Cancel a booking
- Prevent double-booking under concurrent requests
Constraints/notes
- All state is in memory (assume a single process unless you choose to extend to multiple nodes).
- Clarify assumptions (e.g., time zones, check-out exclusivity, maximum date horizon).
- Discuss complexity trade-offs and how you would handle concurrency.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.