You'll get access to over 3,000 product manager interview questions and answers
Recommended by over 100k members
I would begin by asking the following clarifying questions:
- -Are there any special use cases such as VIP Penthouse access, restricted floors etc?
- -Do we need to consider safety requirements or other technical constraints such as maximum load/capacity?
- -If the lobby for the building located on the ground floor? Can we assume that the majority of the guest amenities are located near the lobby and lower floors?
- -Can we assume that the passenger controls on the floors are purely directional(up and down)?
Let's assume a simple scenario with no special use cases, no safety or technical considerations and a standard building layout with the lobby and public amenities located on the ground floor.
With these inputs, our goals should be to optimize the elevator algorithm for efficiency and good user experience as follows:
- -The elevator should move sequentially through requested floors in the same direction, moving from the lowest requested floor to the highest requested floor in the up direction, and from high to low in the down direction -> This will ensure that users do not get confused or frustrated about their desired direction and will also ensure that the elevators more energy-efficient.
- -The elevator should continually process passenger requests and update their route/stop plan dynamically -> This will lower wait times for waiting passengers and ensure the elevators are handling requests in a timely manner.
- -When there are no requests, the elevators should idle on different floors respectively (the lobby or the 100th floor)
Zooming into a more detailed view of the whole experience affords us the opportunity to establish further constraints and rules:
- -A single elevator proceeds in the same direction until the last request in that direction. It will then remain idle until the next request comes in, then it will proceed in the direction of that request.
- -Requests or signals from passengers are received and logged in memory, the elevator prioritizes passenger pickups/dropoffs from floors that it is closest to at the (time of request) and where passenger moving in the same direction
- -When a passenger gets on, they select the floor they would like to be dropped off at, the elevator queues drop-offs sequentially all the while optimizing and updating the route plan with incoming pickup requests
- -The elevator cannot pick up passengers if their request comes in when the elevator has already traveled past the floor that the elevator is currently passing or stopped at i.e. it cannot switch directions and pick up a passenger.
To translate these requirements into an algorithm for a single elevator I would split the mechanics and design a modular system as follows:
- -Implement a Listen/Queue controller that is constantly listening for new requests and dynamically updating the queue with passenger pickup and destination requests.
- -Implement a Move controller that is constantly checking the elevator's current floor and issuing commands for the elevator's three main actions -> STOP and GOTO (floor) and IDLE
Then I would establish the following constants and variables for use in the algorithm logic:
Variables
Let Request Floor**(RF)** = the floor that elevator must stop at to pickup or drop-off a passenger
Let CurrentFloor**(CF)** = the floor that elevator is currently stopped at or is just traveling past.
Let PassengerDirection(PDir) = the direction in which the passenger wishes to travel
Let ElevatorDirection(EDir) = the direction in which the elevator is going
Let RequestQueue = a dynamically changing array of floors that the elevator uses to store it's requests
Listen & Queue Module Logic
- Receive incoming RF. Receive PDIR(in the case of pickup only).
- If (PDIR == EDIR) && (RF > CF) *this is specific to a lift moving in the up direction, (RF < CF) for down
- Add RF to RequestQueue
- Sort RequestQueue (by ascending or descending depending on EDir)
- Start Move Module
Move Module Logic
- Process RequestQueue if RequestQueue is not empty
- RequestQueue.first === CF? -> Comparing first item of RequestQueue with the elevator's current floor (this should be happening continuously on every floor).
- If Yes, then
- STOP at CF ((passenger exits or gets on at CF)
- Remove this RF from the RequestQueue
- Go back to Step 1
- If No, then
- GOTO CF + 1 (next floor)
- If Yes, then
- RequestQueue.first === CF? -> Comparing first item of RequestQueue with the elevator's current floor (this should be happening continuously on every floor).
- Else if RequestQueue is empty 2. IDLE at Ground Floor (IF CF< 50) OR IDLE at Floor 100 IF CF > 51 && <=100
The Listen Module logic is run any time a request is received, ensuring that the queue is always sorted sequentially, it is also responsible for initially kicking off the Move Module logic. However, the control flow in the Move Module should handle the routing and subsequent actions for the elevator.
Further Considerations
To understand whether this algorithm is working efficiently and delivering a good user experience, I would want to track the following metrics at a minimum:
- -wait times per elevator(passenger)
- -average time spent in the elevator per cycle (passenger)
- -cycle times (the time it takes the elevator to go from first to the last point)
- -average number of stops per cycle
Naturally, it would be prudent to drill down onto time of day (peak vs. off-peak), day of the week and season(hotel holiday periods). If any patterns or trends are established from this analysis, we could then tweak or develop the algorithm further.
Clarifying Questions:
Q1 - What type of company are we? Architectural/Design/Manufacturing/Hardware/End-End
Q2 - What's our expertise in similar projects?
Q3- Are we constrained in any form?
Time, Resources, Expertise (or) Finances
Q4- What is the building used for/What type of building?
Office space, apartments, a government institution.
Target Persona:
(to Q4) - I'd pick the response of the interviewer for this question (or) choose any of the options listed based on their responses to Q1, Q2.
Let's consider it to be a 100-story office building & we are designing an elevator for it.
Pain Points:
P1 - Inconsistency in function (downtimes)
P2 - Concerns about physical safety in case of any issues In the building
P3 - High commute time (To get from Floor x to Floor y)
P4 - High waiting time to onboard the lift. (elevator not arrived yet/crowded elevators)
Persona Journey:
The user enters the office space >
Waits for the elevator to arrive (P4) >
Boards the elevator and enters the floor to go to >
Commutes in the elevator for a specific time (P3) >
Drops down at the floor they intend to
From the user journey, it's clear that P3 and P4 are the problems that need to be solved that can cause a high impact on the user.
Probable Solutions: (Ordered by Priority)
S1 P3, P4 - An app to help users discover the average estimate of the waiting & commute time based on the live data of users waiting, entering, and commuting for the elevator - would help in the planning to take the elevator at the right (efficient) time/look for other options.
Con: App development effort (in case of a non-tech company), Live data fetching accuracy.
S2 P4 - Larger elevators in proportion - would help in dealing with the volume better (more people can get in & get out) which would thereby help in reducing the problem of crowded elevators.
Con: Manufacturing effort - costs,feasibility; Space constraints
S3 P3 - Since the commute is long & tiring, could make the experience pleasant through music, air-conditioning, short- multiplayer games, interesting facts about the company, etc.
Con: Difficult to measure the correlation & impact.
Metrics:
S1: # of downloads (acquisition), # of DAU performing a key action - viewing waiting/commute information (engagement), NPS (happiness).
Top Google interview questions
- What is your favorite product? Why?89 answers | 263k views
- How would you design a bicycle renting app for tourists?62 answers | 82.5k views
- Build a product to buy and sell antiques.54 answers | 66.8k views
- See Google PM Interview Questions
Top Technical interview questions
- Imagine you're the product manager for Facebook Marketplace. Since many sellers don't mark items as sold, what existing functionality and metrics could you use to determine whether an item has likely sold?7 answers | 20.9k views
- What happens when you enter a URL in your browser?6 answers | 10.8k views
- How does TinyURL work?5 answers | 317k views
- See Technical PM Interview Questions
Top Google interview questions
- How would you improve Google Maps?53 answers | 228k views
- A metric for a video streaming service dropped by 80%. What do you do?50 answers | 135k views
- Calculate the number of queries answered by Google per second.45 answers | 78.5k views
- See Google PM Interview Questions
Top Technical interview questions
- How would you determine how to rank posts in the newsfeed?4 answers | 3.3k views
- The Chrome team is looking to reduce power utilization on mobile phones when using the browser. How would you go about solving this problem?3 answers | 3.7k views
- How would you map the ocean?3 answers | 2.9k views
- See Technical PM Interview Questions