# Facebook Data Scientist Probability Interview Questions

##### Categories

• Written by:
Nathan Rosidi
Author Bio

A comprehensive approach for solving a Facebook (Meta) Data Scientist probability interview question!

Considering many data science roles require knowledge of probability and statistics, it’s fairly common to encounter a probability-based question during your data science interview. Keep reading to see how you might appropriately answer any probability questions an interviewer asks of you!

Facebook (Meta) started out at Harvard and quickly grew in popularity to become worth over a trillion dollars today. Facebook (Meta) forms part of the Big Five companies in data science with Google, Apple, Microsoft, and Amazon. While primarily known for its social network, it also produces applications such as Messenger, WhatsApp, Instagram, Giphy, and Oculus plus some others.

## Data Science Position at Facebook (Meta)

Given the large diversity of business operations at Facebook (Meta), data scientist responsibilities depend on your business unit and the team to which you’re applying. You can be confident you’ll work on great amounts of data while having the ability to take advantage of the newest visualization, machine learning, and similarly related tools, and, in many cases, you’ll have to apply your probability calculation skills.

Check out our post “Facebook Data Scientist Position Guide” to find out what it means to be a data scientist at Facebook.

## Concepts Tested in Facebook (Meta) Probability Interview Questions

In this Facebook (Meta) data science probability interview question, the primary concepts tested will include:

• Understanding cases and scenarios
• Comparing outcomes
• Combinatorics
• Generalizing a solution for n rounds

With practice questions like this one as well as other probability interview questions, your probability skills can be interview-ready in no time!

## Facebook (Meta) Data Scientist Probability Interview Question

Stones Game

This probability based question appeared during an interview at Facebook (Meta). Its title is “Stones Game”, and the goal is to determine the probability of a player winning based on die rolls which dictate stone swapping.

Basically, we have to find the odds B wins in 1,2 or n rounds based on fair 6-sided die rolls. Furthermore, B is already at a stated disadvantage of 2 stones.

#### Theoretical Framework

We can start this problem with a mathematical analysis of the game.

Because the initial conditions are uneven for the players, our generalization will only work for all rounds after the 1st. However, we can develop a general method to find win and tie probabilities which we can plug in numbers corresponding to the conditions of any round. For this, we’ll first outline some definitions:

xan is the amount of stone where A takes over B at the n-th round

xbn is the amount of stone where B takes over A at the n-th round

An  is the amount of stone player A begins with in the n-th round

Bn is the amount of stone player B begins with in the n-th round

For player B to win a round, they must meet the following conditions:

$A_n + xa_n - xb_n < B_n + xb_n - xa_n$

And for a tie, they must meet the following conditions:

$A_n + xa_n - xb_n = B_n + xb_n - xa_n$

Any round after the first requires equal stones for both players, so our equations simplify even further since:

$A_n = B_n$

when n > 1:

$xa_n < xb_n$
$xa_n = xb_n$

As such, our general solution, will include the following events and their probabilities:

H = B wins the first round which is all cases which fulfill

$A_n + xa_n - xb_n < B_n + xb_n - xa_n$

over all the possible cases from two dice rolls (An, Bn)

I = Game ties in the first round which is all cases which fulfill:

$A_n + xa_n - xb_n = B_n + xb_n - xa_n$

over all the possible cases from two dice rolls (An, Bn)

J = Game ties in the n-th round, where n > 1, which is all cases which fulfill

$xa_n = xb_n$

over all the possible cases from two dice rolls (An, Bn)

K = Player B wins in the n-th round, where n > 1, which is all cases which fulfill

$xa_n < xb_n$

over all the possible cases from two dice rolls (An, Bn)

The final thing to consider for a general solution, is each incremental round is less likely by the probability of a tie when n > 1. As such, our general solution when n = 1 would be:

$P(B_{winsinfirstround}) = P(H)$

And i > 1 would be

$P(B_{winsinnrounds}) = P(I∩J∩K) = P(I)*P(J)^{n-2}*P(K)$

With our equations established, we can now plug in actual cases to calculate probabilities.

#### Practical Framework: B Wins or Ties the 1st Round

First, we’ll determine the conditions under which B can win or tie the 1st round. Since A is ahead of B by 2 stones, player B will win the first round if

$8+xa_1-xb_1<6+xb_1-xa_1$

This simplifies to 1<xb1-xa1 of which any cases where B’s dice roll is at least 2 higher than A’s will fulfill this scenario:

$(xb_1,xa_1) = (3,1),(4,1),(5,1),(6,1),(4,2),(5,2),(6,2),(5,3),(6,3),(6,4)$

This is 10 scenarios out of 6 squared = 36 possible from two dice rolls. Therefore, the probability B wins the first round = 10/36.

There are several cases where the game ties

$1 = xb_1-xa_1$

Any case where B’s dice roll is only 1 higher than A’s will fulfill this scenario:

$(xb_1,xa_1) = (2,1),(3,2),(4,3),(5,4),(6,5)$

so the probability of a tied first round is 5/36.

#### Practical Framework:  B wins or ties the 2nd round

If the 1st round is a tie, the game proceeds to the second round. The 2nd round’s win equation is:

$𝑥𝑎_2 < 𝑥𝑏_2$

where B’s dice roll simply needs to be higher than A’s dice roll.

Conveniently, all the scenarios from the 1st round fulfill this win equation, so the probability B wins in the second round is 15/36.

There are 6 scenarios where the second round ties equating to when B’s dice roll is exactly the same as A’s dice roll, so the probability of a 2nd round tie (and the probability of ties for n rounds after) is 6/36 = 1/6.

#### Practical Framework:  B wins the nth round

For determining B winning in n rounds, we need to multiply several probabilities together. Recall from the earlier analysis how each new tie after the 1st round is less probable due to the tie requirement, so our final probability equation when n > 1 is

$P(B_{winsinnrounds}) = P(I∩J∩K) = \frac{5}{36}*(\frac{1}{6})^{n-2}*\frac{15}{36}$

Keep in mind our initial events specify this will only apply when n is greater than 1. Otherwise, we’ll stick to our original probability of B winning the 1st round.

### Conclusion

Here we analyzed and covered a quick and general solution to the stones game problem heard from a Facebook (Meta) interviewer. ‘Games’ type questions will come up fairly frequently during probability sections of an interview, so it’s important to practice more probability interview questions. Also, check out our post “Facebook Data Science Interview Questions” to find coding questions that Facebook interviewers ask at data science interviews.

##### Categories

• Written by:
Nathan Rosidi
Author Bio

Become a data expert. Subscribe to our newsletter.