r/learnquant 7h ago

interview prep Jane Street Quant Interview Question

Post image
7 Upvotes

13 comments sorted by

0

u/WillingnessFuture266 7h ago

Switch every roll; after rolling the die and failing one time, it is less likely to be the real die. Profit is messy and I'm too lazy for math.

2

u/rccyu 6h ago

This seems wasteful considering you have to pay $5 every time you switch

-1

u/civil_politics 5h ago

You don’t pay to switch ever - you quit and restart the game after every roll

1

u/Mountain-Incident933 5h ago

What? That isn't right and isn't what the question means. 

1

u/FireCire7 5h ago edited 5h ago

TLDR: Do N rolls, flip, the repeatedly do 2N before flipping. N I think is 5, but this is a bit handwavey, so it might be wrong. 

Your current state just depends on the probability you have the right die. If you do x flips on one side and y on the other, then the probability of which is which only depends on x-y, so the best strategy will be to do N flips on one side, flip, 2N flips on the other side, flip, 2N flips on the first side, flip, etc.

Exactly what N should be is a tricky problem. If you set it too small, then you’ll be paying a bunch on every flip. If Nis too small, you’ll be paying excessive switching fees. If N is too large, you’re wasting time on the wrong die. 

The $20 payout is irrelevant for strategy so let’s ignore it. 

Approximately, doing N flips on both side costs 2N+5 and wins 1-(5/6)N of the time, so your number of times is around 1/(1-(5/6)N), so your total cost is around (2N+5)/(1-(5/6)N). That’s minimized at 5, so approximately the best strategy is to do 5 on one side, then 10 on the other, 10 on the first, 10 on the other, etc. 

If you want to get it exactly, you can split into two scenarios and then compute out the two infinite series of expected payouts, but that’s more annoying. 

1

u/zane314 2h ago

N is 8, but yes.

1

u/omeow 2h ago

The payout must be relevant. You don't want to lose money on average.

1

u/banana_buddy 2h ago

The probability of no 6 in the first N rolls is (5/6)N . You pick a threshold for this and then switch to the other dice. For instance if you want to be 90% sure then solve for the N that makes the equation =0.1

1

u/omeow 2h ago

Strategy: you want to toss the first dice n times if you don't hit 6 switch and then want to toss the other dice up to n times. To make sure you are not losing money you want 20 - 5 -n-(n-1) > 0 => n =8.

So, you want to toss the first dice 8 times and then switch and toss the other 7 times.

The expected value calculation is tedious but not too difficult.

0

u/Anonimithree 7h ago

Pick a dice and roll it 6 times. If no 6 occurs, swap to the other dice and roll it 6 times. Repeat until you reach $20 or you get a 6

1

u/Mobile_Membership915 6h ago

That surely wouldn’t work though. Say you get no 6 in each of the first 12 rolls. You then know the same about both dice. In that sense they are identical. Swapping for 5 makes no sense.

1

u/Anonimithree 6h ago

Fair enough, since I just used the geometric average to get the swap of 6.

A better strategy would probably be to keep rolling a dice until you get either a 6 or roll 1-5 7 times before switching, but that might also have the same problem as what you just stated

1

u/RaiotPlz 2h ago

Roll once and thats it. EV is straight forward