Implement a calendar with non-overlapping bookings
Company: Microsoft
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Quick Answer: This question evaluates interval conflict detection and efficient range storage skills, assessing algorithm design and data structure competency within the Coding & Algorithms domain.
Constraints
- 0 <= start < end
Examples
Input: ([(10, 20), (15, 25), (20, 30)],)
Expected Output: [True, False, True]
Explanation: Touching at the endpoint is allowed.
Input: ([(5, 10), (1, 5), (10, 15)],)
Expected Output: [True, True, True]
Explanation: Sorted insertion around neighbors.
Input: ([(1, 2), (2, 3), (1, 3)],)
Expected Output: [True, True, False]
Explanation: Later interval can overlap two accepted bookings.
Hints
- Only the predecessor and successor in start-time order can overlap a new interval.