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

64.98% Correct | 35.02% Incorrect
Last Solution submitted on Aug 20, 2024

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers181

Suggested Problems

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!