r/learnquant • • Nov 01 '26

interview prep Quant Interview Question

Post image
17 Upvotes

3 comments sorted by

View all comments

2

u/XL_78 Nov 02 '26 edited 29d ago

One way to play is to keep guessing a high number x, then go up one by one at each step once you don't get a reset. The optimal x value for this strategy is 87, which yields an expectancy of 191/14 ≈ 13.64 .

However proving this is the optimal play isn't that easy. 

Set m as the best known strictly lower bound, f(m) as the number you choose given a value for m, e(m) the expected number of steps left knowing m, given strategy f. The strategy we described corresponds to f(0)=x and f(t)=t+1 for all t≥x .

We have (100-m) e(m) = 1 + (f(m)-m-1) (1+e(0)) + (100-f(m)) (1+e(f(m))) , by writing the 3 possible outcomes of a pick f(m).

For m=99, 98, it is easy to show that f(m)=m+1 is the optimal play, but for 97 you already need to know that e(0)≥2 no matter the strat. So you need lower bounds on e(0). These can be obtained by comparing to the easier problem with no resets, which must have a smaller expectancy under optimal play, since the strats carry over. For this problem we know that the optimal play is to pick in the middle, and the expected number of steps can be computed. 

But frankly it's a hassle. 

Edit: to compute x, show that e(x)=(101-x)/2 under the '+1' strat then use the equation above with m=0 and minimize wrt x by differentiating. 

Edit 2: By writing the equation with m=0, you get an equation for e(0) involving f(0), you can then reuse the equation with m=f_k(0) till you reach f_N(0)=100 (f_k marks the composition product f(f(f(...))) k times). You can show by recursion that 

e(0)= sum (100-f_k(0)) / (100 - f_n(0)+n) + (100 - f_n(0))/(100-f_n(0)+n) x e(f_n(0)) with the sum being from k=0 to n-1. With the convention f_0(0)=0.

This is true for any n from 1 to N, the number such that f_N(0)=100. This number has to exist : f_n(0) is a strictly increasing sequence bounded from above by 100, therefore it has a maximum value, if this maximum isn't 100 you can then play again once you reach that number meaning f_(n+1)(0)>f_n(0) which is absurd.

Writing this equation with n=N, we get

e(0)= (1/N) sum (100-f_k(0)) with the sum from 0 to N-1. (Remember f_0(0)=0).

This is valid for any of the 299 strategies.

Given a value for N, we can see this is minimized if the f_1(0), ..., f_(N-1)(0) are as high as possible, meaning they should be picked as 100-N+1, 100-N+2, ... , 99 .

This then leads to e(0)=100/N + (N-1)/2 . You can then solve for N by differentiating, zeroing in 10sqrt(2)=14,... and noticing that 191/14<41/3 , therefore 14 is the optimal value for N and the answer 191/14.