Amazon Interview Question for SDE1s


Country: India
Interview Type: Written Test




Comment hidden because of low score. Click to expand.
12
of 14 vote

number of ways to pick any 2 socks from 24 socks = 24C2
number of ways to pick 2 BLACK socks from 12 BLACK socks = 12C2

probability of picking 2 BLACK socks = 12C2 / 24C2 = 66/276
probability of picking 2 WHITE socks = 12C2 / 24C2 = 66/276

probability of picking any 2 same color socks = 66/276 + 66/276 = 11/23

- algos July 29, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 2 votes

Hi Guys, i am new and learning. but that above seems not correct.

we have 24 socks, 12 black and 12 white.
picking 1 sock out of 24 is: 1/24.
as we have 12 black socks, picking 1 black sock out of 24 is: 1/24 * 12 = 12/24 = 1/2
so picking of any single color, black or white is, 1/2 chance..

Now to pick the second black sock out of 23 socks (as we have already selected 1) is: 11/23 (as we have 11 black socks left in 23 socks)

So probability of picking 2 block sock is: (1/2) * (11/23) = 11/46

So picking any white or black pair out in dark is: 11/46,

Please correct if i am wrong

- lazylearner August 02, 2013 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

@lazylearner You are correct till "So probability of picking 2 block sock is: (1/2) * (11/23) = 11/46"
But your next statement is wrong.
Probability of picking 2 black socks = 11/46
On similar lines, probability of picking 2 white socks = 11/46
So, probability of picking either 2 black socks or 2 white socks = 11/46 + 11/46 = 11/23

- __xy__ August 02, 2013 | Flag
Comment hidden because of low score. Click to expand.
4
of 4 vote

P(both socks are white) = P(1st sock is white) * P(2nd sock is white) = 12/24 * 11/23 = 132/552

P(both socks are black) = P(1st sock is black) * P(2nd sock is black) = 12/24 * 11/23 = 132/552

P(both socks are the same) = P(both socks are white) + P(both socks are black) = 132/552 + 132/552 = 264/552 = 11/23

- Anonymous July 29, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

There are 6 pairs of white socks and 6 pairs of black socks which means that the total number of socks are 24, so the answer should be
2 * (12 * 11) / ( 24 * 23 ) = 11 / 23
Correct me If I am wrong.

- siddharthjain July 29, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

11/23 is the probability of both being black or white. so for 1 white and 1 black its 1 - 11/23 = 12/23

- ronnie July 29, 2013 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

once you selected one sock, there are 11 out of 23 remaining socks of the same color as selected one, hence 11/23.

- Anonymous July 31, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

P(BB) = 12 * 11 / (24*23)
P(WW) = 12 * 11 / ( 24* 23 )
P(WB) = 1 - ( P(WW) + P(BB) ) = 1 - ( 2 * (11*12) / (24 * 23)) = 12/23

- ronnie July 29, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

(12/24)*(11/23)+(12/24)*(11/23)
=11/23

- Andy August 05, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

required probability is P ( both black OR both white ) = (12C2 + 12C2) / 24C2 = 11/ 23

- Shubh June 20, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The other way to get the same answer:
1st sock could be any one - black or white.
2nd sock of the same color is 11/23.
So probability = 1*11/23 = 11/23
I think this is the simplest logic.

- Andy August 11, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

( (12 C 2) + (12 C 2) ) / (24 C2)
= 11/23

- himanshu October 10, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

12 c2 + 12 c2 for picking 2 same white or black socks from 24c2 gives 11/23

- himanshu October 10, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

2*(12 choose 2) / (24 choose 2)

- G February 14, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The correct answer to the stated question is 50%. If you pick two socks at random, the two possible outcomes--match or non-match--have equal probability, so each outcome has a probability of 50%. The answer being given by everyone else is correct for a different question--what is the probability of a second draw being the same as the first draw conditional on what was selected on the first draw.

- Rafael Robyns May 05, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

good and expectable ans . but in maths you should prove the ans by showing the solution . otherwise your ans is perfect and fine

- vaasavi August 30, 2019 | Flag
Comment hidden because of low score. Click to expand.
-1
of 1 vote

probab.is :1/3*(6/7)*(1/2)*(4/5)+1/3*(3/4)*(1/2)*(4/5)+1/3*(6/7)*(1/2)*(3/4)

- Nikhil July 29, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

hey guys, socks have left and right....you need to take that into consideration...

- vivian September 22, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.


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