Back to problems

Call Elevator

Algorithm · Pinterest · Medium

You are building a simplified elevator dispatch system for a building. Each elevator is described by a two-element array [ , ]. The first element floor is a string giving the elevator's current floor (for instance, "1" or "10"). The second element state is one of three strings: "up", "down", or "idle". A passenger request is also a two-element array [ , ]. Here floor is a string for the floor where the passenger is waiting, and direction is either "up" or "down". When a…

Checking your access…