dsa · medium

My Calendar I

GreyOrangeDesignSorting

MyCalendar.book(start, end) half-open [start, end). True if it does not overlap an existing booking, else false and do not book.

Fill in the MyCalendar class. The starter already walks ops / args and calls your methods — leave the driver at the bottom as-is. Constructors contribute null; booleans print as true / false.

**Example**

`` MyCalendar() → null book(10, 20) → true book(15, 25) → false book(20, 30) → true ``

Constraints

Calls <= 400

Examples

Example 1

Input:
["MyCalendar","book","book","book"]
[[],[10,20],[15,25],[20,30]]

Expected:
[null,true,false,true]

Open in the Dojo editor