Katkat

Probability Limited Stock Covers Every Customer in a Queue

SIG (Susquehanna)Quantitative Trader · Online Assessment

Last updated

A binomial probability question about a queue of N customers who each choose one of two products, with only M units of one product left in stock. It asks for the probability that the stock is enough, or exactly enough, for every customer who wants it, testing distribution modeling and the efficient evaluation of tail sums.

A queue of $N$ customers is waiting in a store. Each customer will buy exactly one item: product A with probability $p$, or product B with probability $q = 1 - p$, independently of everyone else. The store has only $M$ units left of one of the two products, and plenty of the other.

Find the probability that the $M$ units are enough for every customer in the queue who wants that product. The assessment also asks a variant: the probability that the $M$ units are exactly enough, meaning every unit is sold and no customer who wants the product leaves without it. The specific values of $N$, $M$ and $p$ are generated randomly.

Constraints and Clarifications

  • $N$ is a positive integer, $M$ is a nonnegative integer, and $p$ is strictly between 0 and 1.
  • Each customer wants exactly one unit of exactly one product, and that choice does not depend on what is left in stock.
  • The question is stated with product A as the scarce one. If product B is the scarce one, swap the roles of $p$ and $q$.

Clarifying Questions

  • Which of the two products is the one with only $M$ units left?
  • Does "exactly enough" mean that demand for the product equals $M$, so no unit is left over?
  • If a customer's product is sold out, do they buy the other product instead, and does that affect the question?
  • Does each customer buy one unit, or can a customer buy several?

Hints

Hint 1

Count the demand: Define a random variable for how many customers in the queue want the scarce product, and identify its distribution before thinking about the stock.

Follow-up questions

  • What is the expected number of customers who want the scarce product but cannot get it?
  • What is the smallest stock level that serves everyone with probability at least a target level $c$?
  • Given that the customer in position $j$ of the queue wants the scarce product, what is the probability that they get it?