Bird
Raised Fist0

A booking system uses an interval tree but still allows overlapping bookings. What is the most likely cause?

medium📝 Analysis Q6 of Q15
LLD - Design — Hotel Booking System
A booking system uses an interval tree but still allows overlapping bookings. What is the most likely cause?
AThe system does not check for conflicts at all
BInterval tree does not support overlap queries
CBookings are stored in a stack instead
DIncorrect overlap condition used during insertion
Step-by-Step Solution
Solution:
  1. Step 1: Understand interval tree capabilities

    Interval trees support efficient overlap detection if used correctly.
  2. Step 2: Identify cause of failure

    If overlaps occur, likely the overlap condition or insertion logic is incorrect.
  3. Final Answer:

    Incorrect overlap condition used during insertion -> Option D
  4. Quick Check:

    Wrong overlap logic causes conflicts despite interval tree [OK]
Quick Trick: Check overlap logic when interval tree fails [OK]
Common Mistakes:
MISTAKES
  • Assuming interval tree can't detect overlaps
  • Ignoring insertion logic errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes