My Calendar I Problem

My Calendar I Problem — ExecCode Easy DSA Practice

Solve the My Calendar I problem on ExecCode. Free online easy DSA practice in Intervals. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given the input needed to solve My Calendar I. Your task is to otherwise, return false and do not add the event to the calendar. You are implementing a program to use as your calendar. We can add a new event if adding the event will not cause a double booking. A double booking happens when two events have some non-empty intersection (i.e., some moment is common to both events.). The event can be represented as a pair of integers startTime and endTime that represents a booking on the half-open interval [startTime, endTime), the range of real numbers x such that startTime <= x < endTime.

Examples

Input events = [[10, 20], [15, 25], [20, 30]]; Output [true, false, true]

Constraints

0 <= start < end <= 10^9 At most 1000 calls will be made to book.

Practice My Calendar I free on ExecCode. Browse DSA problems, topic map, and placement guides.