Bird
0
0

In a booking system, a bug causes all bookings to be treated as overlapping. What is a likely programming mistake?

medium📝 Analysis Q7 of 15
LLD - Design — Hotel Booking System
In a booking system, a bug causes all bookings to be treated as overlapping. What is a likely programming mistake?
ANot sorting bookings before checking
BUsing OR instead of AND in overlap condition
CUsing AND instead of OR in overlap condition
DUsing a hash map for bookings
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct overlap condition

    Overlap requires start1 < end2 AND start2 < end1.
  2. Step 2: Identify effect of using OR

    Using OR makes condition too loose, causing overlaps to be detected even when there are none.
  3. Final Answer:

    Using OR instead of AND in overlap condition -> Option B
  4. Quick Check:

    Wrong logical operator breaks overlap detection [OK]
Quick Trick: Use AND, not OR, for overlap checks [OK]
Common Mistakes:
  • Confusing AND and OR in conditions
  • Ignoring logical operator impact

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes