Wednesday, February 20, 2013

Those damn dice...

To recap, a dice rolling game contrasts with coin tossing in:

- Coin tossing follows a binomial distribution (which converges to Gaussian); die rolling follows a uniform distribution.

- Tossing m coins gives an expectation value of m/2; rolling an m-sided die gives an expectation value of (m+1)/2.

Since the probability distribution itself for dice game is simpler, the game you would encounter in an interview is usually more complex to compensate for it. Let's start with some easy ones.

DR01
Player A rolls one die for 4 times, aiming to get one 6; player B rolls two dice for 24 times, aiming to get (6,6). Who has a better chance of winning?

DR01 - Answer:
The probabilities are 1-(5/6)^4 vs. 1-(35/36)^24

DR02
When rolling 2 dice, what is P(both are 6 | at least one 6)?

DR02 - Answer:
Bayesian: (1 * 1/36) / (1 - 25/36) = 1/11

DR03
You have two dice, one is 10-sided and the other is 20-sided. What is P(points on 10-sided die > points on 20-sided die)?

DR03 - Answer:
(1 + ... + 9) / 200 = 9/40

See here for more interview questions/brainteasers

2 comments:

  1. Hi

    Can You explain how you got (1+2+3+....9)/200 = 9/40

    Thanks

    ReplyDelete
  2. Hi gg,

    Sure. The denominator, 200, is of course the size of the event space, which is 10*20 = 200.

    For the numerator, if the number on the 20-sided die is:
    1, then the 10-sided die has 9 possible outcomes to top it;
    2, then the 10-sided die has 8 possible outcomes to top it;
    3, then the 10-sided die has 7 possible outcomes to top it;
    .
    .
    .
    9, then the 10-sided die has 1 possible outcomes to top it;
    10, then the 10-sided die has 0 possible outcomes to top it;
    11, then the 10-sided die has 0 possible outcomes to top it;
    .
    .
    .

    ReplyDelete