My Calendar I, is a LeetCode problem. In this post we will see how we can solve this challenge in Python

Problem Description

Your class will be called like this:

MyCalendar cal = new MyCalendar();

MyCalendar.book(start, end)

Example 1:

MyCalendar(); MyCalendar.book(10, 20); // returns true MyCalendar.book(15, 25); // returns false MyCalendar.book(20, 30); // returns true Explanation: The first event can be booked. The second can't because time 15 is already booked by another event. The third event ....

You can find the full details of the problem My Calendar I at LeetCode

Solution: Please check the main.py snippet for the solution.

This solution originally posted at: Github by @kamyu104