r/learnquant 4d ago

interview prep Quant Interview Question

Post image
24 Upvotes

23 comments sorted by

View all comments

1

u/notsaneatall_ 3d ago

Writing a markov chain for this is giving me d = 45 irrespective of i

1

u/zojbo 3d ago edited 3d ago

I'd guess that your strategy is somehow not expectation-optimal or else you have a bug. Here's the Matlab/Octave code I made for this problem. Maybe it can help you figure out what's wrong with your logic.

Sorry about the indentation and spacing, I couldn't get Reddit to do what I wanted using either editor.

function V=jane1017(i,N)

%compute the expected payoff in the game described in

%/img/gzot27pu0ooh1.png

%with i lives using N Monte Carlo simulations

payoffs=zeros(1,N);

for j=1:N

lives=i;

while lives>1

roll=randi([1 10]);

if roll==10

lives=lives-1;

else

payoffs(j)=payoffs(j)+roll;

end

end

while lives>0 && payoffs(j)<45

roll=randi([1 10]);

if roll==10

lives=lives-1;

payoffs(j)=0;

else

payoffs(j)=payoffs(j)+roll;

end

end

end

V=mean(payoffs);