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.