Facebook Interview Question for Software Engineer / Developers


Country: United States
Interview Type: Phone Interview




Comment hidden because of low score. Click to expand.
7
of 7 vote

Events that should happen are (i) dice A is not 6, (ii) dice B is not six, both at the same time, both events are independent. Hence P = P_A*P_B = 5/6*5/6=25/36~= 0.69

- autoboli January 12, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

that's correct !!

- Coder January 12, 2015 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

P = (1-13/36) ~= 0.64

- Himanshu Jain January 12, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Sorry 0.69

- Himanshu Jain January 12, 2015 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

(5/6)^2

- SK January 12, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 2 vote

there are total 5 possible ways to get Count 6 on two Dice
(1,5),(2,4),(3,3),(4,2),(5,1) = 5 possible ways
total possibilities on Two Dice is 36 so it should be 5/36 = 0.13

- Praveen January 12, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

possiblity for not 6 come on dice A is 5/6
similarly ,
possiblity for not 6 come on dice B is 5/6
for both having no 6 is p(A)*p(B) = 5*5/6*6 = > 25/36

- somendra January 13, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

@autoboli is correct and has the shortest solution possible, but if you want to go the longer way we can also do this:
Proability of getting no sixes is 1 - P_getting_1_six - P_getting_two_sixes, where P_getting_1_six = 2 * (1/6 * 5/6) = 10/36 and P_getting_two_sixes = 1/6 * 1/6 = 1/36. 1 - 10/36 - 1/36 = 1 - 11/36 = 25/36 = 0.69. I know it's a long way but just showing another way to do it :)

- Anonymous January 13, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

For the math gurus here, I have one question. I went about this in a different way....and the answer ofcourse is different...as with most probability problems...can you please help me understand the mistake in my thinking? Thanks....

1.
What is the set of all possible outcomes when I roll a dice?

d1 = dice 1. 
If dice 1 has the value in column 1, then what are the possible sums of both dices?

d1    Outcomes possible
1	2 3 4 5 6 7
2	3 4 5 6 7 8 
3	4 5 6 7 8 9 
4	5 6 7 8 9 10
5	6 7 8 9 10 11
6	7 8 9 10 11 12

2.
Total outcomes = 36
Prob of getting 6 = 5/36
Prob of not getting 6 = 31/36.

This is not the same as the others...so, any help is appreciated. Thanks!

- smallchallenges January 13, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

I see what you're trying to do here, and there is a way to make it work out. Essentially, using your setup, the way you would remove all rolls that include a 6 would be to remove the bottom row *and* the rightmost column, as each of those represent any pair of rolls that contain a 6. What you're then left with is a 5x5 matrix, which is 25 possibilities out of your original 36.

+	1 2 3 4 5   | 6
                         
1	2 3 4 5 6   | 7
2	3 4 5 6 7   | 8 
3	4 5 6 7 8   | 9 
4	5 6 7 8 9   | 10
5	6 7 8 9 10  | 11
--------------------
6	7 8 9 10 11 | 12

25 / 36 = ~0.69

The more straightforward way to think of it is to consider the dice entirely independent of each other, because the second roll does not depend on the first. So you need only consider the probabilities of each, multiplied together. That is, the probability of not rolling a 6 with each die is 5/6. Then you have:

5/6 * 5/6 = 25/36 = ~.69

- Nick January 13, 2015 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

Super thanks Nick! I realized my mistake. I misinterpreted the question as the sum of the two dices should be 6...the question is the non-occurrence of any 6 in either of the two dices. As soon as I read your answer, I realized my mistake. So, thanks much!

- smallchallenges January 15, 2015 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

25/36

- Bond January 18, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

P(A = 6) = 1/6
P(B = 6) = 1/6

P(A ==6 U B == 6) = 1/6 + 1/6 - (1/6*1/6)

Now to get the prob of not getting any 6 = 
		1 - P(A ==6 or B == 6)
= 1-2/6-1/36 = 25/36 = 0.69

- Simply February 01, 2015 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More