System Overview - Availability checking
This system checks if a resource (like a product, room, or service) is available for booking or use. It must respond quickly and handle many users checking availability at the same time without errors.
Jump into concepts and practice - no test required
This system checks if a resource (like a product, room, or service) is available for booking or use. It must respond quickly and handle many users checking availability at the same time without errors.
User | v Load Balancer | v API Gateway | v Availability Service | +-----> Cache | v Database
booked_rooms = [101, 102, 103] and a requested room requested_room = 104?booked_slots = {"9AM": True, "10AM": False}
requested_slot = "10AM"
if not booked_slots.get(requested_slot, False):
print("Slot Available")
else:
print("Slot Booked")def is_available(stock, requested):
if requested > stock:
return True
else:
return False
print(is_available(5, 10))