Bird
Raised Fist0

Given existing bookings: [(10, 12), (14, 16), (18, 20)], what will be the result of checking a new booking (12, 14) for conflict using the overlap condition start1 ?

medium📝 Analysis Q13 of Q15
LLD - Design — Hotel Booking System
Given existing bookings: [(10, 12), (14, 16), (18, 20)], what will be the result of checking a new booking (12, 14) for conflict using the overlap condition start1 < end2 and start2 < end1?
AConflict with (10, 12)
BConflict with (14, 16)
CNo conflict
DConflict with all existing bookings
Step-by-Step Solution
Solution:
  1. Step 1: Check overlap with each existing booking

    Check (12,14) against (10,12): 12 < 12 is false, no overlap. Against (14,16): 12 < 16 true, 14 < 14 false, no overlap. Against (18,20): no overlap.
  2. Step 2: Determine conflict result

    No overlaps found with any existing booking intervals.
  3. Final Answer:

    No conflict -> Option C
  4. Quick Check:

    New booking fits between existing without overlap [OK]
Quick Trick: Check each existing booking for overlap carefully [OK]
Common Mistakes:
MISTAKES
  • Assuming touching intervals overlap
  • Ignoring strict less than condition
  • Confusing start and end times

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes