Hedge Funds puzzles, solved step by step
- Puzzles
- 100
- Traced to a firm
- 38
- Topics
- 14
- Hard
- 30
018One hundred lockers start closed. Person 1 toggles every locker, person 2 toggles every second locker, person 3 every third, and so on up to person 100. Which lockers end open?Prop and quant trading firmsLong-short equity funds
Try it first
Which lockers end open?
Show the worked solution
The ten perfect squares: 1, 4, 9, 16, 25, 36, 49, 64, 81 and 100. Locker n is toggled once by each person whose number divides n, so its final state depends on how many divisors n has. Divisors come in pairs, d and n/d, which cancel out. Only a perfect square has an unpaired divisor, its square root, so only squares are toggled an odd number of times and end open.
What decides whether one locker ends open?
A light switch flipped an even number of times ends where it started; flipped an odd number of times, it ends the other way. Each locker is a switch, flipped once for every divisor of its number, so the question is which numbers from 1 to 100 have an odd number of divisors. Locker 12 is touched by persons 1, 2, 3, 4, 6 and 12, six times, and ends closed.
Of the 100 lockers only the ten perfect squares end open, because locker 12 and every non-square has its divisors in pairs, an even number of toggles, while locker 36 and every square has one unpaired divisor, its square root. Why do only perfect squares have an odd number of divisors?
Pair every divisor d with n divided by d. For 12 the pairs are 1 and 12, 2 and 6, 3 and 4: six divisors, even. The pairing breaks only when a divisor is paired with itself, d = n/d, which happens exactly when n is a perfect square. For 36 the pairs are 1 and 36, 2 and 18, 3 and 12, 4 and 9, with 6 left over: nine divisors, odd, so locker 36 ends open. There are ten squares up to 100, so ten lockers.
The relationshipd a divisor of the locker number n n/d its partner divisor What it says in wordsDivisors cancel in pairs, and only a perfect square leaves one divisor without a partner.Why does a fund ask a puzzle like this?
It tests whether you look for structure before you simulate. Walking through a hundred people toggling lockers is hopeless in an interview; turning it into a question about divisors takes one sentence and makes the answer obvious. The move, recasting a process as a property you can count, is the one that turns a messy trading rule into a quantity you can compute. Check it on a small case out loud: with 10 lockers, 1, 4 and 9 end open.
Where candidates lose it
Candidates start simulating: person 1 opens everything, person 2 closes the evens, person 3 toggles multiples of 3, and they lose track by person 5. The interviewer wants you to stop and ask what decides one locker's final state.
The other miss is answering the primes. A prime is touched exactly twice, by person 1 and by the person with its own number, so every prime ends closed.
What the interviewer asks next
- Which lockers are toggled exactly three times?
- With 1,000 lockers, how many end open?
- Which locker under 100 is toggled the most, and how many times?
032Two ice cream sellers each choose a spot on a straight 1 km beach. Sunbathers are spread evenly along it and each walks to the nearer seller. Where do the sellers end up, and is that the best outcome for the customers?Prop and quant trading firmsLong-short equity funds
Try it first
Where do two self-interested sellers settle?
Show the worked solution
Both end up side by side in the middle, and customers are worse off. From the quarter points, a seller who steps inward keeps everyone behind them and wins beach from the rival, so both drift to the centre. There they still split customers half and half, but the average walk doubles from 125 m to 250 m. Competition moves the sellers to the spot that maximises share, not the one that serves customers best.
Why can neither seller stay at the quarter points?
Picture two petrol pumps on a highway. Each wants the drivers on its own side plus as many from the middle as it can reach first. A seller keeps every customer on the far side of them wherever they stand, so moving towards the rival only ever adds customers. From 250 m, A steps to 400 m against B at 750 m: the dividing line moves to the midpoint, 575 m, and A's share rises from 50% to 57.5%. B then responds the same way, and the dance ends only when both stand at 500 m.
Sellers at the quarter points split the beach evenly with an average walk of 125 m; when A edges inward to 400 m it wins 57.5% of the beach, and the process ends with both at the middle, still splitting 50/50 but with the average walk doubled to 250 m. What does the middle cost the customers?
With both sellers in the centre, a sunbather is on average a quarter of the beach away, 250 m. With sellers at 250 m and 750 m, nobody is more than 250 m away and the average is 125 m. The shares are identical in both setups; the only thing that changed is how far customers walk, so the stable outcome is strictly worse for them and no better for the sellers. This is the {term('Hotelling model', 'A model of competition on a line, set out by Harold Hotelling in 1929, in which rivals crowd towards the centre to win the middle ground.')}, and it is why rival shops cluster and why two parties often converge on the middle voter.
Say the equilibrium idea in one line: a pair of positions is stable when neither player can do better by moving alone, and the middle is the only such pair here. Then say where the model breaks: if customers stop buying when the walk is too long, or if prices can differ, the sellers have a reason to spread out again. Interviewers ask this to see whether you can reason about another player's best response, which is most of trading.
Where candidates lose it
The common loss is answering the quarter points, because that is the sensible arrangement. The question asks where self-interested sellers end up, and the quarter points are not stable.
The second loss is getting to the middle but not saying what it costs. The interviewer wants the contrast: same shares, twice the walking. Name the stable point, then name the welfare cost.
What the interviewer asks next
- What happens with three sellers?
- If customers refuse to walk more than 300 m, where do the sellers stand?
- Where do you see the same pattern in markets or in fund positioning?
093Four people must cross a narrow bridge at night with one torch. They take 1, 2, 5 and 10 minutes to cross, at most two can cross at a time, a pair moves at the slower person's pace, and the torch must be carried on every crossing. What is the fastest time for all four to get across?Prop and quant trading firmsLong-short equity funds
Try it first
What is the fastest crossing?
Show the worked solution
17 minutes. 1 and 2 cross (2 minutes), 1 returns (1), 5 and 10 cross together (10), 2 returns (2), and 1 and 2 cross again (2). The total is 17. The obvious plan, with the fastest person escorting everyone, takes 19, because the 5 and the 10 each cost a separate crossing. Pairing the two slowest hides the 5 inside the 10.
Why is the obvious plan not the fastest?
The natural plan uses the quickest person as a shuttle: 1 walks each person over and comes back. That costs 2 + 1 + 5 + 1 + 10 = 19. Every slow person who crosses on a separate trip pays their own time in full, so the 5 and the 10 together cost 15 minutes of crossing. Think of sending two slow parcels in one courier van instead of two: the second rides along for free.
The shuttle plan spends 5 and 10 minutes on separate crossings and takes 19 minutes, while sending 5 and 10 together costs 10 minutes for both and brings the total to 17, even after the 2-minute person makes one extra return trip. How does the 17-minute plan pay for pairing the slow two?
Pairing 5 and 10 costs 10 instead of 15, a saving of 5. But someone fast must already be waiting on the far side to bring the torch back afterwards. That setup costs one extra return by the 2-minute person and an extra crossing of the pair 1 and 2, so the net saving is 2 minutes: 19 down to 17. The general rule: pair the two slowest when twice the second-fastest time is less than the fastest plus the second-slowest, here 4 against 6.
The relationship10 the one crossing that carries both the 5-minute and the 10-minute person 2 + 2 the extra cost of having the 2-minute person bring the torch back and cross again What it says in wordsPairing the two slowest saves 5 minutes of crossing at a cost of 3 extra minutes of torch returns and re-crossing.How do you show 17 is the minimum?
Five crossings are unavoidable: three over and two back. If the 5 and the 10 cross separately, the forward trips cost at least 10 + 5 + 2 and the two returns at least 1 each, which is 19; if they cross together, the person who returns next must already be across, which forces the returns to be the 1 and the 2, and the best total is 17. Talking through that bound is what separates a remembered answer from a reasoned one, and it is what lets you handle the follow-up with different times.
Where candidates lose it
19 minutes is the answer most people reach, and it comes so quickly that they stop there. The interviewer is waiting to see whether you ask what the 5-minute person costs and whether that cost can be hidden.
The second loss is finding 17 by trial and error without the reason. Name the saving, 5 minutes from pairing, and its price, the extra return and re-crossing; that is what makes the answer hold when the interviewer changes the times.
What the interviewer asks next
- The times are 1, 5, 6 and 10. Does pairing the two slowest still help?
- Add a fifth person who takes 20 minutes. What is the fastest crossing now?
- State the general rule for when to pair the two slowest walkers.
