Suppose two players A and B play ping pong. The first player to get to 11 points wins the match. The players alternate after every 2nd serve (e.g. player A serves twice first, then player B serves twice and so on).
If A is serving, the probability of A winning the point is pA.
If B is serving, the probability of B winning the point is pB.
If player A serves first, what is the probability of player A winning the match? Can you determine the solution algorithmically?
[ Hint Optimized solution will use DP]