Search
⌘K

Leetcode 729. My Calendar I

Design a data structure that supports booking half-open intervals [start, end) so that book(start, end) returns true and inserts the interval only if it causes no overlap with existing bookings (otherwise returns false). With up to 1000 calls and times in [0, 1e9], typical solutions check neighbors in a sorted list or use a BST to detect overlaps efficiently.

Asked at:

Google

Google


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Late November, 2024

Google

Google

Mid-level

Implement a room booking function that accepts start_time and end_time as parameters and returns True if the room can be booked or False otherwise. The function should handle overlapping time slots.

Early November, 2024

Google

Google

Mid-level

Implement a variation of the My Calendar I problem

Comments

Your account is free and you can post anonymously if you choose.