Skip to content

729. My Calendar I #613

Answered by kovatz
mah-shamim asked this question in Q&A
Sep 26, 2024 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

We need to store each event and check if the new event conflicts with any of the existing events before booking it. Since at most 1000 calls to book are allowed, we can store the events in a list and iterate through them to check for overlaps when booking new events.

Plan:

  1. Storing Events: We'll maintain a list where each entry is a pair [start, end] representing the booked time intervals.
  2. Check for Conflicts: Before adding a new event, we'll iterate through the list of booked events and check if the new event conflicts with any existing event. An overlap occurs if the new event's start time is less than the end time of an existing event and the new event's end time is greater than the st…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@mah-shamim
Comment options

mah-shamim Sep 26, 2024
Maintainer Author

@kovatz
Comment options

kovatz Sep 26, 2024
Collaborator

Answer selected by mah-shamim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested medium Difficulty
2 participants