Portfolio Management puzzles, solved step by step
- Puzzles
- 100
- Traced to a firm
- 31
- Topics
- 13
- Hard
- 30
003A car leaves town A for town B, 100 miles away, at 50 miles an hour. At the same moment a bird leaves B at 100 miles an hour, flies to meet the car, turns back to B, then turns again toward the car, and keeps shuttling until the car reaches B. How far does the bird fly?BlackRockNew York · 2025
Try it first
Answer inside ten seconds.
Show the worked solution
200 miles. The car needs 100 miles at 50 miles an hour, which is two hours. The bird flies without stopping for those two hours at 100 miles an hour, so it covers 200 miles, however many times it turns. Summing the legs gives the same answer: 66.7 there and back, then 22.2 there and back, each pair a third of the one before, which adds to 200.
Why is summing the legs the slow way?
Picture a dog on a walk that runs ahead to the gate and back to you, over and over, until you reach the gate. Nobody counts the dog's sprints; you just ask how long the walk took and how fast the dog runs. When something moves at a constant speed for a known time, distance is speed times time, whatever path it traces. The bird's zig-zag looks like the hard part of the question. It is a distraction. The only thing that matters is when the flying stops, and that is when the car arrives.
The car takes two hours to cover 100 miles at 50 miles an hour, and the bird zig-zags between B and the car for exactly those two hours, so at 100 miles an hour it flies 200 miles; the shrinking legs of 66.7, 66.7, 22.2, 22.2 and so on add to the same total. How do you check 200 the long way, in case the interviewer asks?
The bird and the car close at 150 miles an hour, so they first meet after 100 / 150 of an hour, 40 minutes, when the car is 33.3 miles from A and the bird has flown 66.7 miles. The bird flies 66.7 miles back to B. By then the car is 66.7 miles along, 33.3 miles from B, and the same geometry repeats on a gap a third as large. Each round trip is a third of the one before, so the legs form a geometric series: 133.3 times one over one minus a third, which is 200.
The relationshipD the distance from A to B, 100 miles v_{car}, v_{bird} the speeds, 50 and 100 miles an hour What it says in wordsThe bird's distance is its speed times the car's travel time; the geometric sum of its legs confirms it.Why ask this on a quantitative research desk? Because the same move, stepping back from the path to the total, is how you price anything path-dependent in your head: ask what is conserved or fixed before tracing every step.
Where candidates lose it
Candidates start computing the first meeting point, then the second, and lose the room in arithmetic. The interviewer is watching for the moment you ask how long the bird flies; some interviewers stop you once you begin summing legs.
The second trap is saying infinite because the bird turns infinitely often. A sum of infinitely many shrinking terms can be finite, and here it is.
What the interviewer asks next
- What if the bird flew at 150 miles an hour?
- If both towns sent a car toward each other at 50 miles an hour, how far does the bird fly?
- How many times does the bird touch the car?
Asked at BlackRock, Quantitative Research, New York, 2025 (Wall Street Oasis):
A car starts at point A going 50 miles an hour towards point B, and a bird starts at point B going towards point A at 100 miles per hour
016A stock's prices over six days are 7, 1, 5, 3, 6 and 4. What is the most you can make with one buy followed by one later sell? And what is the most with any number of buy and sell trades, if you can hold at most one share and cannot short?Man GroupLondon · 2019
Try it first
With unlimited trades, what is the maximum profit?
Show the worked solution
5 with one trade and 7 with any number. With one trade, buy at the lowest price that comes before a higher one: buy at 1 on day 2 and sell at 6 on day 5, for 5. With unlimited trades, collect every day-to-day rise and sit out every fall: 1 to 5 earns 4, 3 to 6 earns 3, a total of 7. The general answer is the sum of the positive daily changes.
How do you find the best single trade without checking every pair?
Walk through the prices once, like a shopper who notes the cheapest price seen so far and asks each day how much they would make selling today. The best single trade is the largest gap between today's price and the lowest price seen before today, found in one pass. At day 2 the low is 1. Day 3 offers 5 minus 1, which is 4; day 5 offers 6 minus 1, which is 5; no later day beats it. The trap is subtracting the lowest price from the highest overall: the high of 7 comes before the low of 1, so it cannot be sold after buying.
On prices of 7, 1, 5, 3, 6 and 4, one trade catches the widest later gap, buying at 1 and selling at 6 for 5, while unlimited trades catch each rise, 4 and then 3, for 7. Why is the unlimited answer just the sum of the rises?
Any profitable trade from a low to a later high can be split into daily steps, and it gains only on the up days inside it while paying for every down day it sits through. With no limit on trades and no shorting, the best strategy holds the stock on every day it rises and nothing on every day it falls, so profit equals the sum of positive daily changes. Here that is 4 plus 3, which is 7. One pass through the prices gives the answer, which is the point of asking a coding-flavoured candidate.
The relationshipp_t the price on day t \max(p_{t+1}-p_t, 0) a day's rise, or zero on a falling day What it says in wordsOne trade is the widest later gap; unlimited trades collect every daily rise.Say the limitation as a portfolio manager would: this is perfect hindsight with no costs. Add a transaction cost per trade and the two answers move toward each other, because catching a small rise is no longer worth paying for.
Where candidates lose it
The common mistake is answering 6, the highest price minus the lowest, without checking that the high comes after the low. The interviewer is testing whether you respect the order of time.
For the second part, candidates sometimes add the falls as well, answering 9 or more, as if they could short. Reread the constraint: no shorting means falls are only avoided, never earned.
What the interviewer asks next
- What if you are allowed at most two trades?
- Each trade now costs 1. What is the best total?
- Write the one-pass algorithm for the single trade and say its running time.
Asked at Man Group, Alternative Investments, London, 2019 (Wall Street Oasis):
Given a series of prices, find the one buy/sell trade pair which gives the maximum profit
043You have n cars, each fuelled to drive exactly 1,000 miles, and fuel can be moved from one car to another along the way. Tanks cannot be overfilled. How far can one car get, and how does that distance grow as n becomes very large?Millennium ManagementLondon · 2024
Try it first
With four cars, how far can one car get?
Show the worked solution
1,000 x (1 + 1/2 + 1/3 + ... + 1/n) miles, which grows without limit but only like the logarithm of n. Drive all n cars 1,000/n miles; together they have burned one full tank, so one car can refill the rest and be abandoned. Repeat with n minus 1 cars for 1,000/(n minus 1) miles, and so on. Four cars reach 2,083 miles, 100 cars about 5,187, and the distance tracks 1,000 x (ln n + 0.577).
When should a car drop out of the convoy?
Think of friends sharing water on a long walk, where every bottle is full at the start and nobody can carry more than one. The moment the group has drunk exactly one bottle's worth, one friend can pour the rest of theirs into everyone else's bottles and head home. A car should drop out the instant the convoy has burned exactly one tank in total, because that is the first moment its remaining fuel exactly fills the others. With n cars that happens after 1,000/n miles, since n cars burn fuel n times as fast as one.
Four cars travel 250, 333, 500 and 1,000 miles in successive legs as one car at a time tops up the rest and drops out, reaching 2,083 miles. The distance with n cars keeps growing but ever more slowly, from 2,929 miles with 10 cars to 5,187 with 100. Why does the distance grow only like a logarithm?
The total is 1,000 times the harmonic sum 1 + 1/2 + ... + 1/n. Each extra car adds the shortest leg of the journey, 1,000/n miles, so the gains shrink as the convoy grows, and the harmonic sum rises like ln n plus about 0.577. It never stops growing, so any distance is reachable in principle, but slowly: 10 cars reach about 2,929 miles, and getting past 5,000 miles takes 83 cars. Doubling the fleet adds only about 1,000 x ln 2, roughly 693 miles.
The relationshipn the number of cars at the start 1000/k the leg driven while k cars remain 0.577 the Euler-Mascheroni constant What it says in wordsEach leg is one tank shared among the cars still running, and the legs add up to a harmonic series.Why a hedge fund asks it: the structure is the same as scaling a strategy. Each extra unit of capital or effort buys a smaller increment, and a candidate who sees the diminishing returns and names the rate of decay is showing the instinct the desk wants. Also be ready to argue optimality in one sentence: any plan that drops a car earlier wastes fuel it cannot hand over, and dropping later wastes the fuel spent carrying a car that is no longer needed.
Where candidates lose it
The quick wrong answers are n times 1,000, as if all the fuel could be pooled into one car, or a flat 1,000 because tanks cannot be overfilled. Both skip the key idea that the convoy itself consumes fuel while carrying the reserve.
Work n equals 2 out loud first: drive 500, pour the rest of car 2 into car 1, and drive 1,000 more, for 1,500. Then generalise. The interviewer wants the harmonic series and the words grows like log n.
What the interviewer asks next
- Roughly how many cars do you need to travel 10,000 miles?
- What changes if cars can come back to a depot and cache fuel along the road?
- Where do you see diminishing returns of this shape in portfolio construction?
Asked at Millennium Management, Investments, London, 2024 (Wall Street Oasis):
Suppose you have n cars, each fueled so that they can drive for 1000 miles.
088An n by n by n cube, like a Rubik's cube, is built from small cubes. As a formula in n, how many of the small cubes show at least one face on the outside?T. Rowe PriceBaltimore · 2020
Try it first
For n = 3, a standard Rubik's cube, how many small cubes show a face?
Show the worked solution
n cubed minus (n minus 2) cubed, which expands to 6n squared minus 12n plus 8. Everything not on the surface forms a hidden cube with one layer peeled from each side, so its side is n minus 2. For n = 3 that is 27 minus 1, or 26; for n = 10 it is 488. If the interviewer means the coloured squares instead, the answer is 6n squared.
Why count what you cannot see?
To count the tiles round the edge of a courtyard, it is easier to measure the whole yard and subtract the inner lawn than to walk the border without counting corners twice. The cubes not on the surface form one clean block of side n minus 2, so subtracting it from n cubed avoids every double-counting trap at the edges and corners.
In a 3 by 3 by 3 cube only the centre cube is hidden, so 26 of the 27 show a face; the same subtraction of a hidden core of side n minus 2 gives 8, 26, 56, 98 and 488 for n equal to 2, 3, 4, 5 and 10. The relationshipn^3 all the small cubes (n-2)^3 the hidden core after peeling one layer from every side What it says in wordsSurface cubes are all cubes less the core you cannot see.How do you check the formula a second way?
Count by type. There are always 8 corner cubes, 12 edges each carrying n minus 2 cubes between the corners, and 6 faces each with an (n minus 2) by (n minus 2) centre. That is 8 plus 12(n minus 2) plus 6(n minus 2) squared, which expands to 6n squared minus 12n plus 8. Two routes agreeing is the check the interviewer wants to hear.
Two edge cases show care. The formula needs n of at least 2; a single cube, n = 1, is all surface, and the formula would wrongly give 2. And the question is sometimes asked as surface area: the number of coloured squares is 6n squared, 54 for a standard cube. Ask which is meant before answering.
Where candidates lose it
The fast wrong answer is 6n squared, which counts the stickers, not the cubes: every edge cube is counted twice and every corner three times. On a standard cube that gives 54 against the true 26.
The second loss is giving the formula with no check. Say the corner, edge and face split once; it takes ten seconds and proves the algebra.
What the interviewer asks next
- How many small cubes show exactly two faces, as a formula in n?
- For what n are more than half the cubes hidden?
- Now the cube is n by n by m. Generalise the count.
Asked at T. Rowe Price, Equities, Baltimore, 2020 (Wall Street Oasis):
Give an equation that yields the surface area of an n by n by n Rubic's cube based on number of blocks per side.
