## Amazon Interview Question for SDE-2s

• 1
of 1 vote

Country: United States
Interview Type: In-Person

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

Thinking out loud her - answer is not complete.

The remaining runs to win is T_b - T_a. It has to be achieved in 120 - B_b where B_b is the number of balls faced by Team B till now.
Now each ball has a possibility in the set { 0, 1, 2 ,3, 4, 5, 6, NoBall, Wide, Wicket }
The possibilities which contribute to runs are {1,2,3,4,5,6,Wide,NoBall}
There are 120 - B_b balls remaining lets say it is "b" for simplicity.
For each ball there are 10 possibilities and hence b*10 total possiblitites to pick from
But scoring possiblities are 8. hence b*8 possibilities
Probability of picking these possibities are b*8/b*10 = 4/5.

Its not over yet.

lets say target is T = T_a - T_b + 1

then T can be expressed as linear expression of those 8 possibilities.

let us say each coefficient in that linear expression is a_1, a_2, a_3, ....a_8.

Now lets say there are "n" such linear expressions

Out of those "n" such linear expressions only some are valid
--> when the sum of coefficients a_1 to a_8 is b

Lets say this number is "m".

If n == 0 then probability is 0
else if m == 0 then probability is 0
else
total probability is (4/5)*(m/n)

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

And how can we calculate this m in the solution, is dp a right approach?

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.

### 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.