We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Artificial Intelligence
- Probability & Statistics - Foundations
- Day 2: Basic Probability Puzzles #1
- Discussions
Day 2: Basic Probability Puzzles #1
Day 2: Basic Probability Puzzles #1
Sort by
recency
|
42 Discussions
|
Please Login in order to post a comment
from math import gcd
def proba(n, k): count=0 dice1=range(1, n+1) dice2=range(1, n+1) for i in dice1: for j in dice2: if i + j <= k: count+=1 nbr_event = n*n
proba(6, 9)
The expectations for this puzzle aren't really clear. For a standard pair of six-sided dice, the problem is simple enough that one can work out the math in one's head and hardcode the answer (
"5/6"
as @kongguibin pointed out). But in a real interview, would one be expected to implement the logic? And would one be expected to make the solution generalizable tom
dice withn
sides?17/21