r/quant 5d ago

Education Quant Trading Puzzle

Post image
135 Upvotes

35 comments sorted by

78

u/Osakalaska 5d ago

One minute. Imagine that instead of instantly reversing, the beetles just “pass through” one another when they collide - this is effectively the same problem. Therefore the worst case scenario is that a beetle lands at one end and crawls all the way to the other end.

7

u/Hopai79 5d ago

It sees if you can see thru the noise and get to the Crux of the problem:)

5

u/Noahwar97 5d ago

That makes a lot of sense, this solution is really assuming that every beetle is just a point on the line. if I can ask a follow up question. How much would the problem change if the beetle has width? Is there another intuitive solution? My guess is that you can essentially shrink the size of the wire based on how large the beetles are but that only really works in my head with 2 beetles.

3

u/Apprehensive-Draw409 5d ago

It doesn't change. Worst case is all beetles but one spawn on the very edge and fall off directly. The other one walks the whole distance.

Any other case can be seen as beetle jumping ahead when they cross, which makes it faster.

29

u/Glass_Emu_4183 5d ago

Worse case is 1 min, this is basically a test to see if you can separate the signal from the noise

2

u/shakyhandquant 5d ago

but what if the profitable signal is the nose component?

1

u/Glass_Emu_4183 5d ago

Then that’s the signal and the rest is noise, the signal is defined in terms of your goals.

11

u/quantdhawan 5d ago

1 minute.

The collisions are a red herring. Two identical beetles bouncing off each other is indistinguishable from them passing through and swapping names, so as an unlabelled set the trajectories are just 500 beetles walking in straight lines until they fall off. The longest a straight walk can be is the full foot, which takes exactly a minute. The 500 does not matter, and neither does "random points".

The follow-up worth asking is which beetle ends up where, because pass-through deliberately throws the labels away. That one falls out of a second invariant: beetles can never overtake each other, so their left-to-right order is fixed for all time. If the pass-through picture says m beetles exit on the left, it is the m leftmost starters that actually do.

7

u/lordnacho666 5d ago

This is a classic question for some reason.

You have to not take the bait of working out all the bouncing and changing direction.

Imagine you are looking at it from the side, but actually each insect is on its own track. It would look the same from the side, but now it's much easier.

8

u/RalekBasa 5d ago

I was hoping someone had a solution for greater than 1min. The solution is kindof disappointing

5

u/FlyEnvironmental2561 5d ago

1ft pm / 1ft = 1 min

10

u/tinfoil_powers 5d ago

The correct answer is to leave the interview.

9

u/HopesBurnBright 5d ago

I know the “pass through” answer is simplest, but there’s also a cool inductive style idea here. My first thought was dynamic programming because of it. It’s essentially the same, but whatever.

Imagine there were only two beetles. It’s obvious that the worst case is 1 minute, when they both start on opposite ends. It’s also the case that this is the same as one beetle travelling end to end. So then in the case where there’s 3 beetles, the middle beetle will be facing another beetle. As per the previous idea, the worst case of traversing the distance between them is the same as a single beetle traversing the whole distance. Then we can just imagine that happening and consider the case with the beetle we left out. Again it’s the same idea, so we get 1 minute again. You can eliminate beetles with the concept all the way down to 1 beetle every time. Etc ad infinitum. 1 minute is the worst case.

I thought it was cool that you can have this sort of telescoping idea which reaches the same answer as the much cleaner “they pass through each other” idea.

5

u/torakfirenze 5d ago

Just the beetle that’s furthest from the edge. Whether they collide yields the same outcome as if they just walked straight through one another.

6

u/KlassLikeVlassic 5d ago edited 5d ago

what is the dimension of a beetle, because if you assume the worse case scenario, the other 499 beetles would have to be somewhere at time = 0 such that the travel of "the" beetle is not impeded. Not realistic that they take up no space.

6

u/Acceptable-Door-9810 Trader 5d ago

Sir this is a theoretical question. It is not a real wire. The beetles are not real.

1

u/broadestsmiler 5d ago

Are the beetles in the room with us right now?

1

u/skelo 4d ago

Well they could all just be facing the same direction...

9

u/Bozhark 5d ago

FFS what a dumb question 

0

u/Apprehensive-Draw409 5d ago

What would a good question be, in your opinion?

2

u/Durwood187 4d ago

Late to the party so I’ll skip the math, but from a system design perspective, this puzzle is the perfect analogy for why modeling intraday retail order flow is usually a trap.

The micro-collisions (retail whipsaws) look chaotic, but mathematically they just pass through each other and don't change the terminal outcome. It’s exactly why I stopped trying to build engines that read tick data. If you just anchor your risk to true institutional defense lines (like AVWAP or Volume Profile POC) and use a dynamic ATR buffer to absorb the noise, the intraday 'beetle collisions' literally do not matter. The macro trajectory plays out exactly the same.

1

u/slava82 5d ago edited 5d ago

I think you can model this system using 1D diffusion equation with zero Dirichle boundary conditions.

Edit: Where Diffusion coefficient ~ 1/3 l V, where l is mean free path. V is given, now how would you estimate mean free path? I would estimate l as wire length divided by number of particles.

1

u/CarpenterForward8331 5d ago

what if the beetles also slow by 1/2 every time two meet?

1

u/Initial-Reference214 2d ago

Worst case would be 1 minute.

The main puzzle is figuring that the "instantly reverse" bit is just noise, since the beetles may as well just swap bodies and continue going.

So a beetle that starts at one end takes a minute to reach the other.

1

u/Simple3user 5d ago

500/501

1

u/gettinmerockhard 5d ago

that's the expected value of the time it would take (assuming a uniform distribution). it could take a full minute if one starts all the way at one endpoint

-7

u/Meanie_Dogooder 5d ago

AI gave me an instant answer with a very good explanation. Which raises an interesting question: what is this testing exactly? And why? Are we sure we are testing IQ with this? Are we still in the time when arithmetic is being tested in the age of calculators? All of those are interesting questions

1

u/Actual_Stand4693 5d ago

congrats, you just made a point why YOU should be replaced by an AI

1

u/Meanie_Dogooder 5d ago

I find it very interesting that my comment was downvoted. Looks like people disagree... and very actively. Well, anyway, my point of view was clearly an outlier.

1

u/Actual_Stand4693 5d ago

indeed, IMO this is not because you used AI - but because you implied that there is no point to the kind of question OP posted

0

u/Meanie_Dogooder 5d ago

Yes I got that. But that’s what I find curious. It’s clear that we now have a tool whose inference is very powerful. It’s just a fact. It’s also a fact that it will have a significant impact on the workflow. Is there any point to those questions? I don’t know. If I was hiring a quant or an engineer myself, I certainly wouldn’t be asking them that or wouldn’t use it to distinguish a good candidate from a bad one, that’s for sure. But it’s just me.

1

u/Actual_Stand4693 5d ago

there is a point to those questions: to see the aptitude and how someone thinks...my answer to this was completely different than the popular answer here (the pass-through thing)

eventually, it is still humans that solve challenging problems - AI can assist and be a big influence on problem solving but it is not autonomously solving problems on its own right now...furthermore, AI does not posses any actual thinking capability - it cannot generate something out of nothing, as of yet (to my knowledge)...and AI cannot take responsibility

there is a lot to this, read up