Expected Waiting Time for a Bus on a 10-Minute Schedule (and With Random Delays)
Company: Optiver
Role: Data Scientist
Category: Machine Learning
Difficulty: easy
Interview Round: Technical Screen
A bus route serves your stop on a fixed schedule: a bus is scheduled to arrive exactly every 10 minutes, around the clock. You walk to the stop at a random moment, with no knowledge of the schedule, and you board the first bus that physically arrives after you get there.
This is a probability brain teaser from a quantitative interview round. You are expected to reason from first principles, state every modeling assumption explicitly, and produce exact expectations rather than simulation estimates.
### Constraints & Assumptions
- The scheduled headway is exactly 10 minutes; the schedule extends indefinitely in both directions of time (steady state, no boundary effects).
- Your arrival time is uniformly distributed over any 10-minute window and is independent of the bus schedule.
- Boarding is instantaneous; you always take the first bus that arrives after your arrival, regardless of which scheduled run it is.
- In Part 2, whether a given bus is late is independent of every other bus.
- Report answers in minutes.
### Clarifying Questions to Ask
- Is my arrival time independent of the schedule, i.e., effectively uniform over a headway cycle?
- Do I care which scheduled run I board, or only the elapsed time until the first bus physically arrives?
- When a bus is "late," is it delayed by a fixed amount, by a random amount, or does it effectively miss its slot entirely?
- Are delays independent across buses, and is it possible for a delayed bus to bunch together with the following bus?
- Do you want an exact expectation, or is an approximation acceptable?
### Part 1
Buses are perfectly punctual. What is your expected waiting time until the next bus arrives?
```hint Where you land in the gap
Consecutive buses are exactly 10 minutes apart, and your arrival instant is uniformly distributed inside one such gap. What is the distribution of the time remaining until the end of that gap?
```
#### What This Part Should Cover
- Modeling the arrival instant as uniform within a single headway interval, with a brief justification.
- Computing the expectation of the resulting waiting-time distribution cleanly.
- A sanity check on the result (it must lie strictly between 0 and 10 minutes, with the right symmetry).
### Part 2
Now suppose each bus independently has a 50% chance of running late. The interviewer intentionally leaves "late" vague. State a precise model of lateness — for example, delayed by a fixed amount $\delta \le 10$ minutes, or delayed so severely that the bus effectively misses its slot — justify your choice, and compute the expected waiting time under your model. Then explain how the answer would change under the other natural model.
```hint Pin down the model first
"A 50% chance of being late" is not yet a probability model. Decide exactly when bus $k$ arrives — for instance $10k + \delta B_k$ with $B_k \sim \text{Bernoulli}(1/2)$ i.i.d. — before computing anything, and state whether a late bus still runs (so buses can bunch) or is effectively cancelled.
```
```hint Inspection paradox
A uniformly random observer is more likely to land inside a longer gap between buses. For a stationary arrival process with gap length $L$, the expected wait is $\frac{E[L^2]}{2\,E[L]}$, not $\frac{E[L]}{2}$.
```
#### What This Part Should Cover
- Translating a vague verbal statement into an explicit stochastic arrival process.
- Correct handling of length-biased sampling (the inspection paradox) rather than naively halving the average gap.
- An exact expected wait under the chosen model, with the algebra shown.
- Sensitivity analysis: how strongly the final number depends on the choice of lateness model.
### What a Strong Answer Covers
Across both parts: rigor in setting up the probability space before computing anything; the structural insight that any variability in headways can only increase a random passenger's expected wait relative to a perfectly regular schedule; explicit, defensible assumptions when the prompt is deliberately underspecified; and consistency checks that tie the two parts together (Part 1 should fall out as a special case of the Part 2 machinery).
### Follow-up Questions
- If buses instead arrived as a Poisson process with mean headway 10 minutes, what would the expected wait be, and why does memorylessness make it different from Part 1?
- In the fixed-delay model with delay $\delta$, how does the expected wait behave as a function of $\delta$, and what value does it take at $\delta = 10$?
- Beyond the expectation, derive the full distribution (or at least the variance) of the waiting time in Part 1.
- Argue that among all stationary arrival processes with mean gap 10 minutes, the perfectly regular schedule minimizes the expected wait of a uniformly random passenger.