PracHub
QuestionsCoachesLearningGuidesInterview Prep
|Home/Machine Learning/Optiver

Expected Wait for a Bus That Runs Late Half the Time

Last updated: Jul 2, 2026

Expected Wait for a Bus That Runs Late Half the Time

Company: Optiver

Role: Data Scientist

Category: Machine Learning

Difficulty: medium

Interview Round: Technical Screen

Buses on a certain route are scheduled to arrive at your stop every $x$ minutes. Independently for each bus, the bus arrives exactly on schedule with probability $1/2$, and exactly $x/2$ minutes late with probability $1/2$ (a bus is never early). You walk up to the stop at a uniformly random moment, independent of the schedule and of the delays, and you board the first bus that arrives after you get there. What is your expected waiting time, expressed in terms of $x$? ```hint Model one schedule slot Place your arrival uniformly inside the interval between two consecutive *scheduled* times. Whether the bus scheduled at the start of that slot is still ahead of you depends on its delay — a late bus scheduled *before* you arrived may still be the one you catch. Condition on the delays of the two surrounding buses. ``` ```hint A renewal shortcut The delays never reorder buses (a delay of $x/2$ is smaller than the $x$ headway), so the timeline is a stationary sequence of gaps $G$ between consecutive bus arrivals. A uniformly random arriver is more likely to land in a long gap, so the expected wait is $\frac{E[G^2]}{2\,E[G]}$, not $E[G]/2$. Work out the distribution of the gap $G$ first. ``` ### Constraints & Assumptions - The scheduled headway is exactly $x$ minutes, and the schedule extends indefinitely (analyze the steady state, ignoring boundary effects). - Each bus is late by exactly $x/2$ minutes with probability $1/2$ and on time otherwise; delays are independent across buses; buses are never early. - Because the maximum delay $x/2$ is smaller than the headway $x$, buses never overtake one another. - Your arrival time is uniform over a long horizon and independent of all delays; the waiting time ends when the next bus arrives at the stop. ### Clarifying Questions to Ask - Is the delay exactly $x/2$ minutes, or up to $x/2$ (e.g., uniformly distributed)? - Are the delays of different buses independent of each other? - Can a bus ever be early, and can buses overtake each other? - Do I board the first bus that physically arrives, regardless of which scheduled run it corresponds to? - Should I treat my arrival as uniformly random in steady state, with no boundary effects at the start of service? ### What a Strong Answer Covers - A precise model of the arrival process — scheduled times plus i.i.d. delays — including a justification that the bus order is preserved. - Correct handling of the subtle case where the bus scheduled just before your arrival is late and has not yet departed, so it is the bus you catch. - A valid averaging argument: either direct conditioning on the neighboring buses' delays with a uniform arrival time, or a length-biased (inspection-paradox) argument over the gap distribution, with awareness of why a random arriver over-samples long gaps. - A closed-form answer in terms of $x$, sanity-checked against the deterministic no-delay baseline of $x/2$, with an explanation of the direction of the change. ### Follow-up Questions - Recompute the expected wait if each bus's delay is instead uniform on $[0, x/2]$. - Generalize: if a bus is late by $d$ minutes with probability $p$ (and on time otherwise, with $d < x$), what is the expected wait as a function of $x$, $p$, and $d$? - What does your gap-based formula say about why irregular headways always increase a random rider's expected wait, even when the mean headway stays the same? - How would the answer change qualitatively if buses instead arrived as a Poisson process with mean headway $x$?

Related Interview Questions

  • How to rank statements by likelihood - Optiver (hard)
  • Market-Making Estimation Game: Optimal Confidence-Interval Strategy Over 5 Rounds - Optiver (hard)
  • Expected Waiting Time for a Bus on a 10-Minute Schedule (and With Random Delays) - Optiver (easy)
  • Fermi Estimation with Confidence Intervals: How Many Houses Does One Year of US Netflix Spending Buy? - Optiver (easy)
  • Quant Trading Game: Expected-Value Betting and Market Making on Coins, Dice, and Cards - Optiver (medium)
|Home/Machine Learning/Optiver

Expected Wait for a Bus That Runs Late Half the Time

Optiver logo
Optiver
Mar 21, 2025, 12:00 AM
mediumData ScientistTechnical ScreenMachine Learning
0
0

Buses on a certain route are scheduled to arrive at your stop every xxx minutes. Independently for each bus, the bus arrives exactly on schedule with probability 1/21/21/2, and exactly x/2x/2x/2 minutes late with probability 1/21/21/2 (a bus is never early). You walk up to the stop at a uniformly random moment, independent of the schedule and of the delays, and you board the first bus that arrives after you get there.

What is your expected waiting time, expressed in terms of xxx?

Constraints & Assumptions

  • The scheduled headway is exactly xxx minutes, and the schedule extends indefinitely (analyze the steady state, ignoring boundary effects).
  • Each bus is late by exactly x/2x/2x/2 minutes with probability 1/21/21/2 and on time otherwise; delays are independent across buses; buses are never early.
  • Because the maximum delay x/2x/2x/2 is smaller than the headway xxx , buses never overtake one another.
  • Your arrival time is uniform over a long horizon and independent of all delays; the waiting time ends when the next bus arrives at the stop.

Clarifying Questions to Ask

  • Is the delay exactly x/2x/2x/2 minutes, or up to x/2x/2x/2 (e.g., uniformly distributed)?
  • Are the delays of different buses independent of each other?
  • Can a bus ever be early, and can buses overtake each other?
  • Do I board the first bus that physically arrives, regardless of which scheduled run it corresponds to?
  • Should I treat my arrival as uniformly random in steady state, with no boundary effects at the start of service?

What a Strong Answer Covers

  • A precise model of the arrival process — scheduled times plus i.i.d. delays — including a justification that the bus order is preserved.
  • Correct handling of the subtle case where the bus scheduled just before your arrival is late and has not yet departed, so it is the bus you catch.
  • A valid averaging argument: either direct conditioning on the neighboring buses' delays with a uniform arrival time, or a length-biased (inspection-paradox) argument over the gap distribution, with awareness of why a random arriver over-samples long gaps.
  • A closed-form answer in terms of xxx , sanity-checked against the deterministic no-delay baseline of x/2x/2x/2 , with an explanation of the direction of the change.

Follow-up Questions

  • Recompute the expected wait if each bus's delay is instead uniform on [0,x/2][0, x/2][0,x/2] .
  • Generalize: if a bus is late by ddd minutes with probability ppp (and on time otherwise, with d<xd < xd<x ), what is the expected wait as a function of xxx , ppp , and ddd ?
  • What does your gap-based formula say about why irregular headways always increase a random rider's expected wait, even when the mean headway stays the same?
  • How would the answer change qualitatively if buses instead arrived as a Poisson process with mean headway xxx ?
Loading comments...

Browse More Questions

More Machine Learning•More Optiver•More Data Scientist•Optiver Data Scientist•Optiver Machine Learning•Data Scientist Machine Learning

Write your answer

Your first approved answer each day earns 20 XP.

Sign in to write your answer.
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.