K hotel bookings
Problem Given hotel booking requests as intervals [checkIn, checkOut) and K available rooms, determine whether all bookings can be honored (or: process bookings, accepting only those that fit).
Input / Output
- Input: intervals, int K.
- Output: feasibility boolean (or max simultaneous rooms needed / accepted bookings per variant).
Constraints
- Up to 10^5 bookings; O(n log n) expected. Checkout day is typically non-conflicting (half-open intervals) — clarify.
Example
- Bookings [1,5), [2,6), [5,8) with K = 2 → feasible (max overlap 2: the [5,8) guest takes the room freed at 5).
asked …