bugfree Icon
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course

Leetcode Problem 729. My Calendar I

729. My Calendar I

Leetcode Solutions

Approach #: Sorted List + Binary Search

  1. Initialize an empty sorted list calendar.
  2. For each book(start, end) call: a. Perform a binary search to find the index idx where start would be inserted. b. Check for a conflict with the event at idx-1 (if it exists). c. Check for a conflict with the event at idx (if it exists). d. If there are no conflicts, insert the event at idx and return true. e. If there is a conflict, return false.
UML Thumbnail

Approach #: Brute Force

Ask Question

Programming Language
image/screenshot of info(optional)
Full Screen
Loading...

Suggested Answer

Answer
Full Screen
Copy Answer Code
Loading...