Free preview

Why this matters: elevator scheduling is a genuinely deep field — real vendors employ people who do nothing else — which makes it perfect terrain for an interviewer to push on. The variations below are the classic pushes. None requires new architecture; each lands in a seam from lesson 02, and knowing which seam is the rehearsal that pays.

Express and zoned cars

Tall buildings dedicate cars to floor ranges: car 4 serves only the lobby and floors 15–20; cars 1–2 own the low zone. Where does that constraint live?

Not in the car. A car that "knows" its zone has scheduling policy leaking into movement machinery — the exact coupling lesson 02 refused. The constraint is an eligibility fact about assignment, so it belongs to the dispatcher: each car carries (or the dispatcher holds) a served-floor set, and the strategy filters candidates before scoring them. The car's state machine, stop sets, and handlers change by zero lines — a zoned car is just a car that's never handed an out-of-zone stop. When a variation lands as a filter in front of an existing decision, you've found the right seam.

Destination dispatch: when the request type evolves

Modern buildings move the choice earlier: you type your destination floor at a hallway kiosk, and a display assigns you a car — there are no buttons inside. Structurally, this is the most interesting variation because it changes the information, not the machinery: a hall call stops being (floor, direction) and becomes (origin, destination).

That richer request lets the dispatcher do what it couldn't before — batch riders by destination, so everyone bound for floor 12 shares a car instead of smearing across three. The strategy interface must evolve (it now scores trips, not directions), and this is worth saying in an interview: seams absorb policy changes; only information changes force interface changes. Everything downstream survives — the car still receives stops, still sweeps. Car calls disappear as a type, which is a reminder that the two-type split was driven by who owns information, and destination dispatch simply moves ownership.

Idle policy: where should an empty car wait?

Our v1 leaves an idle car wherever its last rider got off — fine for correctness, poor for the morning. Real systems park idle cars: return to the lobby before rush hour, distribute across zones at night, or hold position when traffic is unpredictable.

The design question is who decides. Movement is the car's job, but where to wait is a fleet-level judgment using fleet-level information — so the parking policy joins the dispatcher's side of the boundary, expressed as ordinary stops sent to idle cars. One more policy behind the existing seam; the car doesn't know it's being staged, it just has a stop.

Worth one honest sentence in a round: parking trades energy (empty travel) against latency (heading toward predicted demand), and that's why it's a policy rather than a constant.

Starvation: the fairness constraint comes due

Lesson 01's objective included fairness, and naive nearest-car violates it in a specific, traceable way: a call from the far top floor keeps losing the "nearest" contest to the steady drizzle of lobby traffic, and waits unboundedly while the metric — average wait — looks fine. This is the classic failure of optimizing a mean: the pain concentrates in the tail.

The fix lives, again, in the strategy: aging. A call's effective priority grows with its wait time, so a starved call eventually outbids proximity no matter where the cars are. Cost: near-term efficiency dips slightly when an aged call drags a car across the shaft — which is precisely the trade the fairness requirement told you to make. If you rehearse one probe-shaped answer from this chapter, make it this one: name the pathology, name the mechanism, name what it costs.

Growing the bank: what N cars does to the interface

Four cars made assignment a shrug — O(cars) per call, scan and score. Scale the thinking to a campus system coordinating forty cars across linked towers, and the linear scan is still not the problem (forty is small); what strains is the information contract. The strategy's scoring needs each car's position, direction, committed stops, and zone — informally grabbed in v1. At fleet scale that becomes an explicit availability snapshot the dispatcher assembles per decision, and the strategy signature hardens around it. Past that, dispatchers shard naturally by zone or tower, coordinating only at transfer floors.

The deeper observation to voice: the model — state-machine cars, dispatcher-owned assignment, sweep-managed stops — survives the growth untouched. What evolves under scale is the interfaces between the pieces, which is exactly what good separations are for.

Key takeaway

Every classic elevator variation lands in the dispatcher's side of the design: zoning is an eligibility filter, destination dispatch enriches the request and evolves the strategy interface, idle parking is one more policy issuing ordinary stops, and starvation is cured by aging inside the scoring — at a stated efficiency cost. The cars never change, which is the proof the separations were drawn in the right place.

Enjoying the preview?

Create a free account to unlock the rest of this course, the in-browser judge, and live AI mock interviews.

Sign up free to continue