Your program should output a list of stops the elevator makes, along with the time of each stop. The above three requests would be handled by two stops . One on the way up, and one down. Assume that elevators can stop with zero notice. The elevator can service that request.
Elevators can service requests while stopped.
If, however, the request is made at 18 seconds, the doors have closed and the elevator will have to service that request later. If an elevator is going a certain direction and is stopped on a floor, there are no more requests to service in that direction, and a request is made in the opposite direction from that floor, the elevator can change direction and service that request. Each floor request entry will have a time that is greater than or equal to the time of the previous floor request.