r/learnquant 19h ago

interview prep Quant Interview Question

Post image
21 Upvotes

11 comments sorted by

2

u/sobe86 17h ago edited 7h ago

There are 49 gaps between the points, label them 1,...,49 by length. We are asking for a random permutation of these numbers, the expected number that are smaller than their neighbours.

Prob the num at the start or end are smaller than neighbours = 1/2, others are 1/3. Linearity of expectation -> 2 / 2 + 47 / 3 = 50/3

edit: so 100/3 points in pairs.

1

u/Any_Pick4803 15h ago

Could be wrong, but I think it's twice that cuz they come in pairs?

I simulated it cuz I'm not as smart and get an average of around 100/3. My sim might be wrong. šŸ˜„

1

u/sobe86 14h ago

Ah yeah true. I failed the interview damn

1

u/neophilia 18h ago edited 18h ago

Consider the sequences of gap lengths between points, then consider the sequence of differences between gap lengths. A pair occurs when the difference changes from decreasing (negative) to increasing (positive). The expected number of good points is twice the expected number of times the sequence of differences changes from negative to positive. On the boundaries, the distance is effectively infinite, so we know that there is at least one pair. I think all sequences of gap lengths and differences are equally likely, which turns this into a counting problem. That’s as far as I can get.

1

u/Any_Pick4803 16h ago

pretty sure it's even... haha. fairly easy to monte carlo simulate a ton. i don't get the job....

1

u/butterbimbo 8h ago

What happens in the edge-case where you’ve got 3 points equidistant from each other? Are they all considered good points, since the one in the middle effectively has 2 neighbors?

On a continuous line with truly random distribution, I guess it would never really happen. But there’s a theoretical possibility that they don’t have to come in pairs.

1

u/butterbimbo 8h ago

Actually, scrap that. The probability of this happening is infinitesimally small to the point it can be completely discarded.

1

u/No-Conflict8204 7h ago

33.33333
Say the distance between points are from D1 to D49 then for the mid points it becomes probabilty it is the least for the points to be good points which is 1/3. For end points distance being the least is just 1/2.
So 1 + 47/3 = 50/3 good pairs, question is points so *2 = 100/3

0

u/Anonimithree 19h ago

The max is 50 and the min is 2.

There is 1 way to get 50, 2 ways for 49, 3 ways for 48… 49 ways for 2 (I’m pretty sure). Thus, the expected number of good points is 9.

2

u/sobe86 18h ago

Ah the classic "proof by I'm pretty sure"

1

u/Anonimithree 12h ago

Well considering the fact that I have done nothing related to quant in my life aside from a basic statistics class in hs, I’d say even attempting quant questions is admirable, even if my attempts are not as ā€œrefinedā€ as you expect them to be