Model Elevator Dispatch for Sequential and Overlapping Calls

Read the full interview experience this question came from →

Quick Overview

Design elevator dispatch state for sequential calls from floor one and overlapping calls that require advancing elevator state before assignment.

Model Elevator Dispatch for Sequential and Overlapping Calls

Company: Pinterest

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: hard

Interview Round: Onsite

Design the state model and dispatch logic for an elevator simulation that returns the elevator assigned to the final call in a sequence. Explain two versions: calls that finish before the next call begins, and calls that may overlap in time. ### Part 1 — Sequential Calls There are `n` elevators, all initially on floor 1. Each call finishes before the next arrives. Explain what each call must specify, how a dispatch policy chooses an elevator, and how the chosen elevator's state changes after completion. #### What This Part Should Cover Preserve the initial floor and sequential completion assumption. Identify missing pickup, destination, eligibility, and tie-breaking rules rather than silently supplying them. ### Part 2 — Overlapping Calls Elevators now start in arbitrary supplied states and may still be serving an earlier call when a new one arrives. Explain how to advance their states to the new call's time before deciding which elevator can serve it. #### What This Part Should Cover Represent time, position, direction, availability, and pending work as needed by the declared movement and dispatch policy. Define how equal-time events are ordered and how to identify the elevator assigned to the final call. ### Constraints The movement speed, door time, capacity, dispatch objective, and call format are unspecified. Initial states in the overlapping version are inputs, not a requirement to generate random states. Any concrete policy used in an example must be labeled hypothetical. This exercise asks for a conditional design, not a unique executable answer. ### Clarifying Questions - Does a call include a pickup floor, destination, direction, and timestamp? - Must an elevator be idle to accept a call, or can it add compatible stops? - Do we choose nearest distance, earliest pickup time, or another objective? - What happens when no elevator can immediately accept a call? ```hint Advance time before dispatch The elevator that was closest at the previous call may have moved or become available by the next call's timestamp. ``` ### What a Strong Answer Covers - Correct sequential and overlapping state models with explicit unresolved policies. - A consistent event-processing order and distinction between assignment and completion. - Conditional algorithms, complexity, and boundary cases tied to the selected rules. ### Follow-up Questions - How would equal pickup times be resolved deterministically? - How would accepting intermediate stops change the state representation?

Overview: Design elevator dispatch state for sequential calls from floor one and overlapping calls that require advancing elevator state before assignment.

Read the full Pinterest Software Engineer interview experience this question came from

|Home/Software Engineering Fundamentals/Pinterest
Pinterest logo
Pinterest
Aug 28, 2026
hardSoftware EngineerOnsiteSoftware Engineering Fundamentals
0
0

Design the state model and dispatch logic for an elevator simulation that returns the elevator assigned to the final call in a sequence. Explain two versions: calls that finish before the next call begins, and calls that may overlap in time.

Part 1 — Sequential Calls

There are n elevators, all initially on floor 1. Each call finishes before the next arrives. Explain what each call must specify, how a dispatch policy chooses an elevator, and how the chosen elevator's state changes after completion.

What This Part Should Cover Guidance

Preserve the initial floor and sequential completion assumption. Identify missing pickup, destination, eligibility, and tie-breaking rules rather than silently supplying them.

Part 2 — Overlapping Calls

Elevators now start in arbitrary supplied states and may still be serving an earlier call when a new one arrives. Explain how to advance their states to the new call's time before deciding which elevator can serve it.

What This Part Should Cover Guidance

Represent time, position, direction, availability, and pending work as needed by the declared movement and dispatch policy. Define how equal-time events are ordered and how to identify the elevator assigned to the final call.

Constraints

The movement speed, door time, capacity, dispatch objective, and call format are unspecified. Initial states in the overlapping version are inputs, not a requirement to generate random states. Any concrete policy used in an example must be labeled hypothetical. This exercise asks for a conditional design, not a unique executable answer.

Clarifying Questions Guidance

  • Does a call include a pickup floor, destination, direction, and timestamp?
  • Must an elevator be idle to accept a call, or can it add compatible stops?
  • Do we choose nearest distance, earliest pickup time, or another objective?
  • What happens when no elevator can immediately accept a call?

What a Strong Answer Covers Guidance

  • Correct sequential and overlapping state models with explicit unresolved policies.
  • A consistent event-processing order and distinction between assignment and completion.
  • Conditional algorithms, complexity, and boundary cases tied to the selected rules.

Follow-up Questions Guidance

  • How would equal pickup times be resolved deterministically?
  • How would accepting intermediate stops change the state representation?
Loading comments...