Problem 1268. Penny flipping - calculate winning probability (easy)
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
Asif Newaz
on 13 Dec 2019
https://en.wikipedia.org/wiki/Gambler%27s_ruin#Fair_coin_flipping
Solution Comments
Show commentsProblem Recent Solvers183
Suggested Problems
-
Remove all the words that end with "ain"
2370 Solvers
-
MATCH THE STRINGS (2 CHAR) very easy
290 Solvers
-
1067 Solvers
-
Find the area of the four walls
279 Solvers
-
What is Sum Of all elements of Matrix
418 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!