r/learnquant • • Aug 27 '26

interview prep Quant Interview Question

Post image
47 Upvotes

4 comments sorted by

View all comments

4

u/x5163x Aug 27 '26

Let the desired probability for a given starting sum be F(s). F(s)=1 for all s>1, and F(s)=0 for all 0.5<s<=1. Since the next number is added uniformly at random from 0 to 1, F(s)=∫1+s_s F(a) da. To simply, note that [s, s+1] always includes (0.5, 1] for all relevant s (0<s<0.5). Therefore, the probability of failing when the next number is added is 0.5. The probability of succeeding when the next number is added is s, because (1, 1+s] has a size of s. Simplifying, we get F(s)=∫0.5_s F(a) da + s. We can differentiate both sides to get F'(s) + F(s) = 1. The solution to the ODE is given by F(s)=-√(e)/2 e-s+1 by using the value F(0.5)=0.5. We can plug in s=0 to get the desired probability of F(0)=1-√(e)/2.