Search
⌘K

Leetcode 470. Implement Rand10() Using Rand7()

Implement rand10() using only the uniform rand7() API so that outputs 1..10 are equally likely; the core challenge is converting a size-7 uniform distribution into size-10 (typically by combining samples and using rejection sampling or base expansions) while minimizing the expected number of rand7() calls.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.