Lime | Scooter Reservations
Anonymous User
588

We would like to build a new feature called Reservation.

Assume Lime only has one scooter at a location and the feature will allow riders to book
it with start time and end time. We can assume the start time and end time are both integers representing the number of the minute from the starting of the day and we are only allowing making a reservation of the day: don’t need to worry about crossing to the next day.

Let’s build the class and method that Contains the data structure to support the reservation feature.
A method/function called “add” that checks if a particular appointment can be added. If it
can be added, return true and add the new appointment to the existing list of appointments. If not, return false.

Constrain: one scooter can’t be promised to two riders at the same time, i.e. no
overlapping appointment in time.

 0 -> 24 hours blocks in a day
 3-5, 7-9 reserved hour blocks
 
 1-2 reserve, open 
 3-4 unavailable, overlaps 
 1-4 unavailable, overlaps
 1-6 unavailable, overlaps 
 0-1 reserve, open

2^64 possible inputs

Comments (2)