Medium · System Design
My Calendar I
Given a sequence of book(start, end) calls for half-open intervals [start, end), return for each call whether the interval can be added without overlapping any previously accepted booking (touching endpoints is allowed); accepted bookings are kept.
Examples
Example 1
{
"books": [
[10, 20],
[15, 25],
[20, 30]
]
}Output: true, false, true
Example 2
{
"books": [
[10, 20],
[30, 40],
[5, 25],
[12, 15],
[20, 30],
[25, 35]
]
}Output: true, true, false, false, true, false
Rebuild it in the studio
Open every published interview problem, solution, scene, and memory room free, with no account.