The interview problem

Practice prompt

Match a new ride request to vehicles without violating existing riders' capacity, pickup or detour promises.

Original practice, not a reported company interview. Scenarios and numbers are illustrative. Interview date: not applicable. Sources retrieved October 1, 2026.

1. Scope and worked approach

Assume travel-time estimates, current vehicle routes and explicit service bounds. Generate nearby candidates, enumerate feasible pickup/drop-off insertion positions, and reject any route violating precedence, capacity or time windows. Score remaining insertions by incremental cost and customer impact. Reserve the chosen route version atomically before notifying riders; recompute if another dispatcher changed it. Predictions are uncertain, so retain operational slack.

2. Trace the design or derivation

Generate vehicles
  → enumerate insertions
  → check constraints
  → reserve route version
  → notify

A route update should include a feasibility explanation and the estimate timestamp. When a vehicle deviates or a rider cancels, rerun affected constraints rather than merely remove one waypoint. Keep the old assignment until the replacement is durably accepted so dispatcher retries do not strand riders between routes.

3. Calculate the example

An existing route is 20 minutes. Inserting a pickup and drop-off produces a 27-minute route, adding seven minutes overall. If an existing rider's arrival moves from minute 12 to 18, their detour is six minutes; a five-minute promise makes this insertion infeasible despite acceptable total cost.

4. Failure cases and trade-offs

Optimizing only fleet distance hides individual delays. Stale traffic estimates and concurrent assignments invalidate feasibility. Exhaustive insertion grows with route length; candidate pruning saves computation but can miss better matches. Rejecting a ride is preferable to silently breaking a hard promise.

5. Validation, follow-ups and self-review

Test capacity at each segment, pickup-before-dropoff and route-version races. Follow-up: how does uncertainty change slack? Self-review: distinguish route cost, per-rider constraints and atomic assignment.

Sources and related practice

Technical reference: developers.google.com — Constrained routing with time windows; warehouse and pooling examples are original.

Source publication/update: Not established. Retrieved October 1, 2026. The workflow, calculations and review exercises are original; this reference is not evidence that a company asked this question.

Continue with Design an arrival-time prediction system; Assign players to matches without double booking.

Continue your preparation

Choose a connected learning path or browse more System design questions. Read our editorial method and attribution policy.