Back to problems

Probability That One Fair Die Beats Another

Algorithm · ByteDance · Medium

You are given two fair dice, a and b, as integer arrays. Each entry in an array represents one physical face of the die, so a repeated face value stands for several distinct, equally likely faces. The two dice do not need to have the same number of faces. Implement: Return the probability that one roll of a yields a value strictly greater than one roll of b. Outcomes where both rolls show the same number are not counted as wins. Your implementation should handle large inputs…

Checking your access…