Probability Limited Stock Covers Every Customer in a Queue
Company: Sig
Role: Quantitative Trader
Category: Statistics & Math
Difficulty: medium
Interview Round: Online Assessment
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.
```hint 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.
```
### 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?
### What a Strong Answer Covers
- Modeling the demand for the scarce product as a sum of independent indicators and naming its distribution
- The difference between the "enough" and "exactly enough" events, with an expression for each
- Efficient and numerically safe evaluation, including the cases $M \ge N$ and $M = 0$
- A reasonableness check, such as a complement or an approximation, for large $N$
### 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?
Overview: 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.
Read the full Sig Quantitative Trader interview experience this question came from