Can Anyone please explain how to solve this DP Problem


Why doesnt we simply answer as x/y where x is red and y is green ball

x/y is not a probability, it’s just a ratio. Let’s just say that there are 2 red and 1 green balls. Then according to you, the probability is 2. But probability can never be more than 1. Did you mean x/(x+y)?

sorry i meant to say x/x+y

The answer is
\frac{x}{x+y} + \frac{y}{x+y}\frac{y-1}{x+y-1}\frac{x}{x+y-2} + \frac{y}{x+y}\frac{y-1}{x+y-1}\frac{y-2}{x+y-2}\frac{y-3}{x+y-3}\frac{x}{x+y-4}, but this is probably harder to code, maybe?

x/(x+y) will be the probability that satyam wins on the first draw. You should also consider the possibility that he can win on his second, third or later draws.

Oh Yes…Thanks :sweat_smile: My bad :slight_smile:
Again Thanks