You begin with start units. Each round you win one unit with probability
p and lose one otherwise, stopping at either goal or 0. Return the
probability of reaching goal first.
With q=1−p and r=q/p:
P=⎩⎨⎧goalstart1−rgoal1−rstartp=0.5p=0.5
Input
start = 10
goal = 20
p = 0.5
Output
0.5
Premium problem
This one's part of Premium. Unlock the full Probability track plus every other premium problem on the site.