0
$\begingroup$

The question can be described as follows. You have a die that rolls between 1 and W max points. You stop rolling when you hit K points. What is the probability you get N points or less? This is actually this leetcode question here: https://leetcode.com/problems/new-21-game/.

I am really confused by the posted solution so I thought I would ask on math.stackexchange. In the solution, people calculate the probability of getting i points where i is any number between 1 and K + W - 1. This is because you stop rolling when you hit K points.

Then, the final solution is given as the sum of the probabilities you found between K and N. This seems incorrect to me. Shouldn't it be a conditional probability? Shouldn't it be the sum of the probabilities from K to N divided by the sum of the probabilities from K and K + W - 1.

If anyone could enlighten me here, that would be appreciated.

$\endgroup$
14
  • $\begingroup$ If you stop if and only if you have accumulated $K$ points, then the sum of probabilities between $K$ and $K+W-1$ inclusive is $1$ $\endgroup$ Sep 19, 2021 at 1:44
  • $\begingroup$ Yes this is what i am claiming but this is not what the solution on leetcode says. $\endgroup$ Sep 19, 2021 at 1:48
  • $\begingroup$ i may be missing something here. Sum of probabilities from $K$ to $N$, divided or not divided by the sum of probabilities from $K$ to $K+W-1$ are the same because the later is $1$ right? $\endgroup$ Sep 19, 2021 at 1:51
  • $\begingroup$ How can we prove this though? $\endgroup$ Sep 19, 2021 at 2:15
  • $\begingroup$ As long as you are sure that all possible outcomes are in $[K,K+W-1]$ then the sum of probabilities there must be $1$ $\endgroup$ Sep 19, 2021 at 2:35

0

Your Answer

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

Browse other questions tagged or ask your own question.