u/anykash

Three random numbers from 0 to 1. What's the expected value of the biggest? [Probability · Easy]

Draw three numbers independently and uniformly at random from the interval [0, 1]. What is the expected value of the largest of the three?

Drop your answer with your reasoning in the comments. Solution tomorrow.

Hint: >!don't just average 1/2 with itself. the maximum is pulled upward toward 1.!<

reddit.com
u/anykash — 7 days ago

On average, how many die rolls to see every face at least once? [Probability · Easy]

You roll a fair six-sided die over and over. On average, how many rolls does it take until you've seen every face at least once?

Drop your answer with your reasoning in the comments. Solution tomorrow.

Hint: >!the answer is bigger than you'd guess. the final missing face alone takes 6 rolls on average.!<

EDIT

The solution:

>!The expected number of rolls is 14.7.!<

>!Break the process into stages by how many distinct faces you've already collected. Once you've seen k different faces, any roll lands a new face with probability (6−k)/6, so the number of rolls to get the next new face is geometric with expected value 6/(6−k). Sum these waits across all six stages: 6/6 + 6/5 + 6/4 + 6/3 + 6/2 + 6/1 = 1 + 1.2 + 1.5 + 2 + 3 + 6 = 14.7. Notice the last term: when you're down to one missing face, each roll only has a 1/6 chance of being it, so that final face alone takes 6 rolls on average, more than the first four faces combined. That heavy tail is why most people lowball this at 6 or 12. The general formula n·Hₙ is the classic Coupon Collector result, and it shows up everywhere from cache-miss analysis to estimating how long an A/B test needs to run to cover every variant.!<

More puzzles like this at myntbit.com

u/anykash — 9 days ago

An ant random-walks the edges of a cube. Expected steps to reach the opposite corner? [Random Walks · Medium]

An ant sits at one corner of a cube. At every step it picks one of the three edges meeting its current corner, uniformly at random and independently each time (so it's allowed to backtrack), and walks along it to the next corner.

What is the expected number of steps before it first reaches the corner diagonally opposite its start?

Drop your answer with your reasoning in the comments. Solution tomorrow.

Hint: >!don't write eight equations. the cube's symmetry collapses it to three.!<

EDIT

The solution:

>!The expected number of steps is 10.!<

>!The trap is to set up an equation for all eight corners. Symmetry cuts that to three. Group the corners by their distance from the target corner D: the start A is distance 3, there are three corners at distance 2 (call the class B), three at distance 1 (class C), and D itself. By symmetry, every corner in a class has the same expected steps to reach D, so let a, b, c be those expected values.!<

>!Now read off the moves. From the start, all three edges lead to distance-2 corners, so a = 1 + b. From a distance-2 corner, one of its three edges goes back toward the start (to A) and two go forward to distance-1 corners, so b = 1 + (1/3)a + (2/3)c. From a distance-1 corner, two edges go back to distance-2 and one reaches D, so c = 1 + (2/3)b.!<

>!Solve the system: substituting gives b = 3 + (3/5)a, and since a = 1 + b, we get a = 4 + (3/5)a, so (2/5)a = 4 and a = 10. The whole problem cracks open the moment you collapse the eight vertices into four symmetry classes instead of grinding eight equations.!<

More puzzles like this at myntbit.com

u/anykash — 13 days ago

5 people check their hats, get them back at random. Odds nobody gets their own? [Probability · Easy]

Five guests check their hats at the opera. The clerk loses every tag and hands the hats back in a uniformly random order, with every possible arrangement equally likely. What's the probability that not a single guest gets their own hat back?

And the follow-up: as the number of guests grows very large, what does that probability approach?

Drop your answer with your reasoning in the comments. Solution tomorrow.

Hint: >!the probability barely changes whether it's 5 guests or 5,000. that's the real surprise.!<

EDIT:

The solution

>!The probability is 44/120 = 11/30 ≈ 0.367, and as the number of guests grows it approaches 1/e ≈ 0.368.!<

>!An arrangement where nobody gets their own hat is called a derangement. To count them, use inclusion-exclusion: start with all 5! = 120 arrangements, subtract the ones where at least one person gets their own hat, add back the overlaps you double-subtracted, and so on. That alternating process gives the derangement formula !n = n!·(1 − 1/1! + 1/2! − 1/3! + … + (−1)ⁿ/n!). For n = 5 that's 120·(1 − 1 + 1/2 − 1/6 + 1/24 − 1/120) = 44, so the probability is 44/120 = 11/30. The series in the parentheses is exactly the expansion of e^(−1), so as n grows the probability converges to 1/e. The surprise is how fast it gets there: it's already about 0.375 at n = 4 and 0.367 at n = 5, so adding more guests barely moves it, and it never decays toward 0. The usual traps are flipping the inclusion-exclusion signs, or assuming more guests makes a full mismatch less likely when it actually stabilizes almost immediately.!<

More puzzles like this at myntbit.com

u/anykash — 14 days ago

Random-walking knight starts in a corner. Expected moves to come back? [Random Walks · Hard]

A knight wandering at random eventually comes home. How long does it take?

Place a knight on a corner square of an empty 8×8 chessboard. On each move it looks at every square it could legally move to from where it currently sits, picks one of those uniformly at random, and jumps there. It repeats this forever.

Counting from its first move, what is the expected number of moves until the knight lands back on its starting corner for the first time?

Drop your answer with your reasoning in the comments. Solution tomorrow.

Hint:

>!this looks like a brutal 64-state Markov chain. there's a one-line shortcut hiding in it.!<

EDIT

The solution:

>!The expected number of moves is 168.!<

>!The trap is to set up a 64-state Markov chain and grind through it. There's a one-line shortcut once you see this as a random walk on a graph. Make every square a node, and connect two nodes whenever a knight can hop between them in one legal move. The knight making random moves is exactly a random walk on this graph. For a random walk on any connected undirected graph, the expected time to return to a starting node v has a clean closed form: 2|E| / deg(v), where |E| is the total number of edges and deg(v) is the number of edges meeting at v. The 8×8 knight's graph has 4(n−1)(n−2) edges, which for n=8 is 4·7·6 = 168 edges. A corner square has only two legal knight moves out of it, so deg(corner) = 2. That gives 2·168 / 2 = 168. As a sanity check, a central square has 8 legal moves, so its return time is 2·168/8 = 42, which fits the intuition that well-connected squares pull the knight back faster and isolated corners take far longer. The whole difficulty is spotting that "random knight moves" is just "random walk on a graph."!<

>!(For anyone wondering: yes, the knight always returns with probability 1. It just always takes an even number of moves, since each move flips square colour, which is fully consistent with an average of 168.)!<

More puzzles like this at myntbit.com

u/anykash — 15 days ago

Break a stick at two random points. What are the odds the three pieces form a triangle? [Probability · Medium]

Take a stick of length 1. Pick two points along it independently and uniformly at random, and break it at both points at once, giving three pieces.

What's the probability the three pieces can form a triangle?

Drop your answer with your reasoning in the comments. Solution tomorrow.

Hint - >!a triangle needs every piece to be shorter than the other two combined. that's the whole condition.!<

EDIT

The solution

>!The probability is 1/4.!<

>!Three lengths form a triangle exactly when no single piece is longer than the other two combined. Since the three pieces add up to 1, that's the same as saying every piece must be shorter than 1/2, because any piece reaching 1/2 or more is at least as long as the rest put together. So the pieces form a triangle if and only if all three are under 1/2. Now call the two break points X and Y, each uniform on [0,1] and independent, so every outcome is a point (X, Y) in the unit square and probability equals area. Take the case X < Y: the pieces are X, Y − X, and 1 − Y, and forcing each below 1/2 gives X < 1/2, Y > 1/2, and Y − X < 1/2, which carves out a triangle of area 1/8. The case X > Y is a mirror image with the same area 1/8, so together they give 1/8 + 1/8 = 1/4. The catch is that this answer is specific to the "two independent uniform cuts" setup. The popular variant "break it once, then break the longer piece" is a different experiment and gives roughly 0.193 instead, so always pin down the cutting rule first.!<

More puzzles like this at myntbit.com

u/anykash — 16 days ago

29 people, 29 different handshake counts. You can pin down exactly one of them. Which and why? [Combinatorics · Medium]

Fifteen married couples (30 people) attend a party. People shake hands, but nobody shakes their own spouse's hand, nobody shakes their own hand, and no two people shake hands more than once. Afterward the host goes around and asks the other 29 guests how many hands each of them shook. Every one of the 29 answers is different.

How many hands did the host's spouse shake?

Drop your answer with your reasoning in the comments. Solution tomorrow.

Hint - >!the host's own number never gets asked. that's the whole key.!<

EDIT

The solution

>!The host's spouse shook 14 hands.!<

>!Start with the range: anyone can shake at most 28 hands, since they never shake themselves or their spouse, leaving 28 possible people. The host got 29 different answers, and the only way to fit 29 distinct numbers into the range 0 through 28 is for them to be exactly 0, 1, 2, …, 28, each once. Now pair people by spouse. The person who shook 28 shook everyone except their spouse, so every other guest shook their hand, including whoever shook 0, which is only possible if the 28-person and the 0-person are married. Peel them off: the person who shook 27 shook everyone except their spouse and the 0-person, so their spouse is the 1-person. Keep going and every married pair's answers add up to 28: (0,28), (1,27), (2,26), all the way to (13,15). That's 14 couples using up 28 of the 29 people the host asked, each matched to their own spouse. Exactly one person is left over, the one who shook 14, and since everyone else is already paired off, their spouse has to be the one person never asked: the host. So the host's spouse shook 14.!<

>!The trap is trying to brute-force the handshake graph. It cracks open instantly once you pair spouses by their counts summing to 28, leaving the lone middle value, 14, as the host's other half.!<

More puzzles like this at myntbit.com

u/anykash — 17 days ago

You're the worst shot in a three-way duel and you fire first. What do you do? [Game Theory · Hard]

Three shooters, and the worst shot has the best odds of living.

Alice, Bob, and Cheri fight a three-way duel. Alice hits 1 in 3 shots, Bob hits 2 in 3, Cheri never misses.

They take turns firing in that order, Alice then Bob then Cheri, looping around, and a shooter is skipped once dead. Everyone plays to maximise their own chance of surviving, and everyone knows everyone else's accuracy. A shooter is allowed to deliberately fire into the air and hit no one.

It's Alice's turn first. What is her best move, and what is her probability of surviving?

Drop your answer with your reasoning in the comments. Solution tomorrow.

Hint: >!shooting the deadliest opponent feels right. work out what happens next and you'll see why it isn't.!<

EDIT

Quick rule clarification, each living player must fire at another player on their turn but firing into the air is still allowed for a single turn, no standing down forever. With that in place, here's the answer

>!Alice's best move is to deliberately miss her first shot, and it gives her the best survival odds of all three at 25/63 (about 40%) a) If she shoots Cheri and hits, it's Bob's turn and he guns for Alice with his 2/3 aim, which is awful for her b) If she shoots Bob and hits, Cheri is up next and kills her for certain. So landing either shot backfires, which means her best play is to throw the shot away and let Bob and Cheri deal with each other. Bob then targets Cheri (the one player who'd kill him for sure), and it splits two ways: if Bob hits Cheri (2/3), it loops back to Alice in a duel where she fires first and survives 3/7; if Bob misses (1/3), Cheri kills Bob and Alice faces Cheri firing first, surviving exactly her 1/3 shot. That gives (2/3)(3/7) + (1/3)(1/3) = 18/63 + 7/63 = 25/63. The twist is that the deadliest shooter is worst off: Bob lands at 24/63 and dead-eye Cheri at just 14/63, because being the obvious threat means everyone aims at you first.!<

More puzzles like this at myntbit

u/anykash — 18 days ago

On average, does HH or HT appear first when you flip a coin? [Probability · Easy]

Two patterns. One looks just as likely as the other. They're not.

Flip a fair coin over and over. On average, how many flips does it take to first see HH?

Now the same question for HT. On average, how many flips until you first see HT?

Same coin, same odds on every flip. So the two answers should match, right?

Drop both numbers in the comments, again solution tomorrow.

Hint : >!they are not the same. one waits noticeably longer than the other.!<

EDIT

The solution

>!HH takes 6 flips on average, HT takes 4. !<

>!With HT, once you flip a heads you're locked in, any tails after it finishes the job and extra heads in between cost you nothing. With HH, you flip a heads and need the very next flip to also be heads, but if it's tails you're back to square one, and that reset is what drags the average all the way up to 6. Both patterns show up with probability 1/4 on any given pair, so people assume they wait the same, but HH can be interrupted right at the finish and HT never can.!<

More puzzles like this at myntbit

u/anykash — 19 days ago

You pick HHH. I pick second. Want to bet on it? [Game Theory · Medium]

Here's a bet that sounds fair but isn't.

You pick any sequence of three coin flips, say HHH. I get to see your pick, then choose my own. We flip a coin over and over until one of our sequences shows up three in a row. Whoever's sequence lands first wins.

You go with HHH.

What should I pick, and what are my odds of beating you?

Drop your answer in the comments. Bonus points if you can explain why it works. I'll post the solution tomorrow.

Hint: >!most people assume it's a coin toss. it really isn't.!<

EDIT

The solution

>!THH, with 7/8 odd!<

>!HHH can only win one way, the first three flips all come up heads (a 1/8 chance). Any other outcome means a tails shows up first, and the moment it does, THH is already halfway there. You've got the T, now you just need two heads, which is exactly what HHH needed anyway. THH always gets there first.!<

More puzzles like this at myntbit

u/anykash — 20 days ago

I built LeetCode for quant finance with 500+ coding questions (py/cpp) and 500+ MCQs

Hey everyone,  so I've been in the quant space for a while, worked at one of the well-known banks. The thing that always bugged me is how scattered interview prep is for this industry. You've got the Green Book for brainteasers, LeetCode for generic coding, Heard on the Street, random PDFs floating around Discord, that one Glassdoor thread from 2019 everyone keeps linking. Nothing that ties it together for quant specifically.

I started helping a few friends prep for quant interviews and just kept building out more material. At some point I had enough stuff that it made sense to turn it into a proper platform. So here we are: myntbit.com

It covers C++ and Python coding (options pricing, order book simulation, low-latency stuff, not just "reverse a linked list"), probability brainteasers, statistics MCQs, market making and trading questions. 1000+ problems across 30+ topic areas and I'm adding new ones every week.

There are 3 career tracks for quant dev, quant researcher, and quant trader. Honestly because prepping for a Jane Street trader role vs a quant dev role at Citadel vs a researcher seat at Two Sigma or HRT are very different things, and lumping them together never made sense to me. Dev track is heavy C++, memory management, low-latency systems design. Researcher is Python, stats modeling, time series, ML. Trader is brainteasers, mental math under pressure, expected value, market intuition.

I also built 4 games for practicing skills like mental math, Kelly Criterion bet sizing, Fermi estimation, and pattern recognition. Good way to break up the grind.

One thing I'm working on right now: structured learning paths. Basically ordered curriculums per track so you're not just grinding random problems but following an actual progression. Fundamentals, then intermediate, then interview ready, with the brainteasers and MCQs woven in alongside the coding. Should ship in the next few weeks. If anyone has thoughts on how it should be structured (week by week plan? difficulty based? topic based?), I'm genuinely all ears. Rather build the right thing than the fastest thing.

There's a free tier with 400+ problems and the games in practice mode, so you can try it without putting in a card.

Still actively building and adding new stuff every week. Would genuinely love feedback on what's useful, what's missing, or what could be better.

Happy to answer questions about the site or quant interview prep in general.

u/anykash — 2 months ago