Meeting Scheduling System
Problem statement
Implement booking requests for one calendar. The calendar starts empty. Each row of requests is [start, end], representing a meeting that occupies the half-open interval [start, end).
Process requests in their given order. Accept a request only if it does not overlap any previously accepted meeting. An accepted meeting stays booked for all later requests. A rejected request leaves the calendar unchanged.
Two meetings overlap when they share any time before either meeting ends. Meetings may touch at an endpoint: [2, 5) and [5, 8) do not overlap.
Return one boolean per request, in the same order: true when accepted, or false when rejected. If there are no requests, return an empty array.
Function
scheduleMeetings(requests: int[][]) → boolean[]Examples
Example 1
requests = [[10,20],[15,25],[20,30]]return = [true,false,true]The first meeting is accepted. The second overlaps the booked interval from 15 through times before 20, so it is rejected. The third starts exactly when the first ends and is accepted.
Example 2
requests = [[5,10],[0,5],[10,15],[0,15]]return = [true,true,true,false]The first three meetings only touch at endpoints, so all three are accepted. The final request overlaps all three accepted intervals and is rejected.
Example 3
requests = []return = []No bookings are requested, so there are no results.
Constraints
0 <= requests.length <= 10^5.- Each request contains exactly
2integers:[start, end]. - Every timestamp is an integer between
0and10^9, inclusive. start < endfor every request.