Two players are playing a fair penny flipping game. For each flip, the winner adds one penny from the loser's collection to his/her collection. This continues until one player runs out of pennies and loses the game.
Calculate the probability of winning for the first player, given the first player's number of coins, m, and the second player's number of coins, n.
Example:
Input: m = 1, n =1 Output: 0.50
Solution Stats
Problem Comments
1 Comment
Solution Comments
Show comments
Loading...
Problem Recent Solvers198
Suggested Problems
-
Find all elements less than 0 or greater than 10 and replace them with NaN
15814 Solvers
-
Calculate the area of a triangle between three points
3539 Solvers
-
We love vectorized solutions. Problem 1 : remove the row average.
895 Solvers
-
743 Solvers
-
Find the area of the four walls
295 Solvers
More from this Author7
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
https://en.wikipedia.org/wiki/Gambler%27s_ruin#Fair_coin_flipping