Data Structures & AlgorithmsHardTCS NQT · probability

Problem: Two fair six-sided dice are rolled. What is the expected value of the larger of the two faces (the maximum)?

  1. A. 7/2
  2. B. 4.5
  3. C. 161/36
  4. D. 126/36

Correct answer: C. 161/36

P(max <= k) = (k/6)^2, so E[max] = sum over k of (1 - (k/6)^2) for k = 0..5, which equals 161/36 (about 4.47). The average of the two values (7/2) is the trap.

More Coding Interview Problems questions

Exams that ask this topic