|
6 | 6 |
|
7 | 7 | <p>A <code>k</code>-booking happens when <code>k</code> events have some non-empty intersection (i.e., there is some time that is common to all <code>k</code> events.)</p>
|
8 | 8 |
|
9 |
| -<p>You are given some events <code>[start, end)</code>, after each given event, return an integer <code>k</code> representing the maximum <code>k</code>-booking between all the previous events.</p> |
| 9 | +<p>You are given some events <code>[startTime, endTime)</code>, after each given event, return an integer <code>k</code> representing the maximum <code>k</code>-booking between all the previous events.</p> |
10 | 10 |
|
11 | 11 | <p>Implement the <code>MyCalendarThree</code> class:</p>
|
12 | 12 |
|
13 | 13 | <ul>
|
14 | 14 | <li><code>MyCalendarThree()</code> Initializes the object.</li>
|
15 |
| - <li><code>int book(int start, int end)</code> Returns an integer <code>k</code> representing the largest integer such that there exists a <code>k</code>-booking in the calendar.</li> |
| 15 | + <li><code>int book(int startTime, int endTime)</code> Returns an integer <code>k</code> representing the largest integer such that there exists a <code>k</code>-booking in the calendar.</li> |
16 | 16 | </ul>
|
17 | 17 |
|
18 | 18 | <p> </p>
|
|
27 | 27 |
|
28 | 28 | <strong>Explanation</strong>
|
29 | 29 | MyCalendarThree myCalendarThree = new MyCalendarThree();
|
30 |
| -myCalendarThree.book(10, 20); // return 1, The first event can be booked and is disjoint, so the maximum k-booking is a 1-booking. |
31 |
| -myCalendarThree.book(50, 60); // return 1, The second event can be booked and is disjoint, so the maximum k-booking is a 1-booking. |
32 |
| -myCalendarThree.book(10, 40); // return 2, The third event [10, 40) intersects the first event, and the maximum k-booking is a 2-booking. |
33 |
| -myCalendarThree.book(5, 15); // return 3, The remaining events cause the maximum K-booking to be only a 3-booking. |
| 30 | +myCalendarThree.book(10, 20); // return 1 |
| 31 | +myCalendarThree.book(50, 60); // return 1 |
| 32 | +myCalendarThree.book(10, 40); // return 2 |
| 33 | +myCalendarThree.book(5, 15); // return 3 |
34 | 34 | myCalendarThree.book(5, 10); // return 3
|
35 | 35 | myCalendarThree.book(25, 55); // return 3
|
| 36 | + |
36 | 37 | </pre>
|
37 | 38 |
|
38 | 39 | <p> </p>
|
39 | 40 | <p><strong>Constraints:</strong></p>
|
40 | 41 |
|
41 | 42 | <ul>
|
42 |
| - <li><code>0 <= start < end <= 10<sup>9</sup></code></li> |
| 43 | + <li><code>0 <= startTime < endTime <= 10<sup>9</sup></code></li> |
43 | 44 | <li>At most <code>400</code> calls will be made to <code>book</code>.</li>
|
44 | 45 | </ul>
|
45 | 46 |
|
|
0 commit comments