LLD - Design — Hotel Booking System
Given this booking function:
What is the main reason for locking the slot before checking availability?
def book(slot):
lock(slot)
if is_available(slot):
confirm_booking(slot)
unlock(slot)
return 'Booked'
unlock(slot)
return 'Unavailable'What is the main reason for locking the slot before checking availability?
