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
|
45 Discussions
|
Please Login in order to post a comment
Check out thia link for full solution with AI and ML use cases, https://youtu.be/0uIdaXmkMSE?si=v4KG2m63H1D45iui
from math import gcd total_outcomes = 6 * 6 favorable = 0 for i in range(1, 7): for j in range(1, 7): if i + j <= 9: favorable += 1 print(f"{favorable // gcd(favorable,total_outcomes)} / {total_outcomes//gcd(favorable,total_outcomes)}")
Quite dissapointed with the instructions of the problem statement , it is clearly mentioned to write a plain text , but we hav eto use print statement if it were python .!! SMH
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?