Solving My Calendar III in go. Please try yourself first to solve the problem and submit your implementation to LeetCode before looking into solution.

Problem Description

Your class will be called like this:

MyCalendarThree cal = new MyCalendarThree();, end)

Example 1:

MyCalendarThree();, 20); // returns 1, 60); // returns 1, 40); // returns 2, 15); // returns 3, 10); // returns 3, 55); // returns 3
The first two events can be booked and are disjoint, so the maximum K-booking is a 1-booking.
The third event [10, 40) intersects the first event, and the maximum K-booking is a 2-booking.
The remaining events cause the maximum K-booking to be only a 3-booking.
Note that the last event locally causes a 2-booking, but the answer is still 3 because
eg. [10, 20), [10, 40), and [5, 15) are still triple booked.


See the full details of the problem My Calendar III at LeetCode

Originally posted at: