1
$\begingroup$

One of the interview questions that I was asked was :

The small commuter plane has 30 seats. The probability that any particular passenger will not show up for a flight is 0.1, independent of other passengers.

Design a function to get largest m value such that expectedshow[m] = expected number of passengers showing up if 30 + m tickets are sold for a flight and expectedshow[m] ≤ 30.

I could not think of a way to approach this question. Can somebody explain it ?

$\endgroup$
1
  • $\begingroup$ First $(30+m)\cdot0.9\leq30\implies0.9m\leq3\implies{m}\leq3.3$. Then $[m\in\mathbb{N}]\wedge[m\leq3.3]\implies\max(m)=3$. $\endgroup$ – barak manos Nov 12 '14 at 16:26
3
$\begingroup$

If $n$ tickets are sold, then the expected number of passengers that will show is $0.9n$, by linearity of expectation.

However, in this problem the variable is not $n$, but $m$, where $n=30+m$. Hence the number of expected passengers that will show is $0.9(30+m)$. Now consider those values of $m$ that make this at most 30; choose the largest. You should get $$\frac{30}{0.9}-30=3.\overline{3}$$ Most likely the interviewer is looking for the floor of this, namely $m=3$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.