Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
A collection of quant riddles with answers (nigelcoldwell.co.uk)
170 points by alexmolas on Aug 3, 2023 | hide | past | favorite | 36 comments


For #14, some of us went a little nuts optimizing the dynamic programming solution down from months/OOM to milliseconds, and going past the original suggested problem size of a few hundred to a maximum problem size of 133 million: https://gwern.net/problem-14


I clicked your link, saw DP, and tabbed away to try and solve it myself first. (I also forgot to sample without replacement and wound up with $2.86.)

Delightful read!


Pleased to hear that - I felt dumb when I made that mistake! But now I know I'm not alone.


is this a related problem to the how many times to flip a coin with a chance to increase your wealth by 50% ? https://www.jasoncollins.blog/posts/ergodicity-economics-a-p...


No because it's not a random walk. Cards in this problem are not put back in the deck after they are drawn, therefore the probability of going +1/-1 depends on how many cards of each color were drawn so far.

It's still markovian though, which means it's straightforward to find a solution (unless you want to go crazy with optimizations as OP suggests).


Is riddle a different name for math problem? I thought they were more a play with words. Like: what becomes larger the more you take away? Answer: a hole.


That's a popular meaning, but not the exclusive one.


These are not riddles.



If you like OP, you'll probably enjoy this video created by Jane Street, to illustrate their interview process: https://youtu.be/NT_I1MjckaU


So, LeetCode?

It's a dynamic programming problem. Working backwards, at round 100 you take the money, at earlier rounds if [remaining rounds] * [current reading] < average([EV at round+1]), then reroll, otherwise take the money.


So the max reading you can get is 20. This is an important consideration. Another consideration is that a take money can be done more than once in a row, so at some point it is optimal for you to take money for all subsequent rolls.

The correct answer is, at any time if you roll a 20, take money for the remaining rounds. On average you'll get a 20 by round 20 if you just roll 20 times in a row, so in that scenario you'll get at least 1600. This makes 1600 the number to beat. So if remaining rounds * current reading > 1600, take the money for all the remaining rounds. This translates to 17 or higher rolls 1-5, 18 or higher rolls 6-11 19 rolls 12-15 and 20 onwards.

That's only the first game in a series of 3 in the video, the remaining ones surprisingly have much simpler answers even though there are more considerations. Second game is if you take money your next round must be to roll, third game is that but if you take money, the casino gets to re roll before you do at its option, it is left ambiguous if the casino roll counts as one of your turns, which makes it 2 games to solve.


There's a reference to the classic Heard on the Street book but you should also check out Zhou's green book, which consists a guide on cracking the type of interview questions Google used back in the mid 2000s/early 2010s (how many ping pong balls can fit in an airplane), with much more demanding problems though:

    A Practical Guide To Quantitative Finance Interviews,  Xinfeng Zhou
https://www.amazon.com/Practical-Guide-Quantitative-Finance-...


> a guide on cracking the type of interview questions Google used back in the mid 2000s/early 2010s (how many ping pong balls can fit in an airplane)

Google never used that type of question, most certainly not in the early 2010s. That genre of question infamously came from Microsoft, much earlier than that.


Isn't there a large gap between the types of Fermi estimation problems you might get in a regular job interview (e.g. Microsoft PgM or McKinsey Associate) and the types of probability/statistical problems you might get in a quantitative finance interview?


Some quant jobs interview both. The fermi estimation problems are much less emphasized, but they're there nonetheless.


Did Google really ask questions like these it is it an urban myth? Supposedly Microsoft did (why is a manhole cover round) but that was supposedly stopped in the early 90s


They difficulty ratings are extremely subjective. Some of the yellows and reds enrichment/contests. Some of the reds are straightforward but tedious trial and error. Then there is a yellow that requires physical and mathematical intuition about bicycle wheels.

Is this really how to get a quant job? A clever high schooler could solve these with hints. I can solve most, but I'm terrible at advanced calculus and statistics.


>Then there is a yellow that requires physical and mathematical intuition about bicycle wheels.

I got this one "wrong" because I assumed it was possible for the bicycle to skid and so swing the back wheel out of alignment.


I got the snowman one “wrong” because the problem didn’t say you couldn’t throw away excess snow. Maybe the lesson is that it’s hard to write word problems.


Generally, if you find a simplification that makes the problem trivial you’re interpreting it wrong and should reconsider.


It’s funny because that’s the opposite of what you’d want in a new hire: you want the engineer to pick a trivial solution rather than over-designing everything, so they can solve more problems for your company.


Ha. Right. I guess it’s just one more way in which the interview is an anti pattern for the behavior we want in a coworker.

Can I Google this? Sorry no.

ChapGPT? Pretend it’s not available.

Use a library? No no no.

Ask for help? Thanks for coming in.


I gave up on that one after finding no non-trivial explanation that made sense to me. I guess in hindsight it makes sense the building material is just given in sphere radius, but that didn't click at the time.

I couldn't make sense of the 100-m race one either. The only thing I could come up with is maybe the clock freezes/race ends when the first person finishes, and the scores are then done by distance to the finish line.


There is a type of bicycle that is sometimes used as an intermediate step to riding a unicycle -- it's basically a unicycle for the back wheel of the bike, with a pivoting bar attached to it with a standard front wheel at the end of it.

Or you could describe it as a regular bicycle with a direct-drive, pivoting, rear wheel.

All of which to say that it is a bicycle, and its wheels can make any track you like as long as the front and back tracks are a fixed distance apart.


A bit confused about the "answer" for #85 (the garden with the 1m path)

We have two right triangles with sides 54m and 40m, so the area of both combined is 54X40.

The area of the rectangle they're in is 55X40.

So the path between them should be 40m?

Where is 66 2/3 m coming from?

edit: never mind, the distance between the two sides of the path is 1m, but the distance from the corner of the triangle to the corner of the garden is greater than 1m


The width of the path is 1m, i.e the height of the parallelogram. The side of the parallelogram is not provided. So, the side of the triangle is not 54m.


> Adam can mow a field in 1 hour, in the same time Bob can mow 2 fields, if they work together how long does it take them to mow a field?

Fred Brooks version: Amy can bear a child in 9 months. Bella also can bear a child in 9 months. If you assign both of them to bear a child, how long will it be before a child is born?


Re: problem 51, a friend of mine made an interesting observation: if the probabilities are different, but always in the same ranking, i.e. Alice is always worst, Bob is always better than Alice, and Cheris always the best shot, there is a mix of probabilities where Alice's most successful strategy changes from the solution to the original puzzle. What are those probabilities? The easy version is to describe the general circumstances. The hard version is to do the math and describe them exactly.


This is really helpful! I'm in my final year and it is time for placements. 99.9% of the campus interviews we receive filter candidates by keeping a pen-paper aptitude test. (Followed by technical MCQ, then DSA, then technical HR and finally general HR).

I'm someone who sucks in aptitude or can say I'm pretty slow but can code pretty fine. In that regard, this is really helpful!


Huh, the riddle about 12 balls with different weights that you need to weigh is fun.

It's a good exercise in thinking about how to get the maximum amount of information out of a measurement.


Secret Santa Question #78, I feel the answer should be 50/50. If the game ends up being void, shouldn't we assign probability 0 to that scenario?


So basically an IQ test in all but name.


Looks much more mathematics than the kinds of things you find in an IQ test.


Yes, that's the thin veil on top of the IQ test. It's similar to programming puzzles asked at tech cos.


I think they’re each measuring one’s ability to do a certain type of puzzle. IQ tests at least attempt to measure general ability across a variety of tasks.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: