Implement a calendar that allows double bookings but never a triple booking. An event is a half-open interval [startTime, endTime). MyCalendarTwo() creates an empty calendar, and book(startTime, endTime) adds the event and returns true if no moment would then be covered by three events; otherwise it returns false and leaves the calendar unchanged.
Implement a calendar that allows double bookings but never a triple booking. An event is a half-open interval [startTime, endTime). MyCalendarTwo() creates an empty calendar, and book(startTime, endTime) adds the event and returns true if no moment would then be covered by three events; otherwise it returns false and leaves the calendar unchanged.