Debt Capital Markets puzzles, solved step by step
- Puzzles
- 100
- Traced to a firm
- 16
- Topics
- 13
- Hard
- 30
025There are 100 closed doors in a row. On pass 1 you open every door. On pass 2 you toggle every second door, on pass 3 every third door, and so on, until pass 100 toggles only door 100. How many doors end open, and which ones?Syndicate desks
Try it first
Quick instinct: how many doors are open at the end?
Show the worked solution
Ten doors end open: 1, 4, 9, 16, 25, 36, 49, 64, 81 and 100. Door n is toggled once on each pass whose number divides n, so it is toggled as many times as n has divisors. Divisors come in pairs, 2 with 6 for 12, so most numbers have an even count and end closed. Only a perfect square has a divisor paired with itself, giving an odd count, so only the squares stay open.
What decides whether one door ends open?
Think of a light switch pressed by everyone who walks past: whether the light ends on depends only on whether an odd or even number of people pressed it. Door n is toggled on pass k exactly when k divides n, so the number of toggles equals the number of divisors of n, and the door ends open only if that number is odd. This changes a hundred passes into one question about numbers.
Why do only perfect squares have an odd number of divisors?
Divisors come in pairs that multiply to the number: for 12 they are 1 and 12, 2 and 6, 3 and 4, six in all. Every divisor has a partner, so the count is even, unless a divisor is its own partner, which happens only when the number is a perfect square. For 16, the pairs are 1 and 16, 2 and 8, and 4 on its own, five in all. Squares up to 100 run from 1 times 1 to 10 times 10, so ten doors.
Of the 100 doors only the ten perfect squares end open, because door 12 is toggled six times by its three divisor pairs and closes, while door 16 is toggled five times, since 4 pairs with itself, and stays open. The relationshipd(n) the number of divisors of n m^2 a perfect square floor of root 100 how many squares fit below 100, which is 10 What it says in wordsToggles equal divisors; the count is odd only for perfect squares, and there are ten of those up to 100.How do you show your working in the room?
Start by tracking one small door aloud, say door 6: passes 1, 2, 3 and 6, four toggles, closed. Moving from a single example to the rule about divisor pairs is what the interviewer is really scoring, more than the final count. Then generalise: with N doors, the open ones are the squares up to N, so the count is the whole part of the square root of N. For 1,000 doors, 31 stay open. The limit is simply that the puzzle is pure logic; its value on a desk is the habit of reducing a big process to one property.
Where candidates lose it
The common wrong answers are 50, guessing that alternate doors survive, and the primes, because primes feel special in divisor puzzles. Primes have exactly two divisors, so they end closed.
The other loss is simulating pass by pass and running out of time. Track one door, find the rule, then count.
What the interviewer asks next
- With 1,000 doors, how many end open?
- Which doors are toggled exactly twice, and what are they called?
- If you only did passes 1 to 50, how many of the 100 doors would be open?
041K investors each send a sorted list of n orders by limit yield. You need one sorted order book. How many comparisons does a naive merge take against a min-heap merge, and why is the heap the right tool as K grows?CitadelNew York · 2026Citadel SecuritiesNew York · 2026
Try it first
Merging 64 lists of 1,000 orders: roughly how many comparisons does scanning every list's front order each time take, against a heap?
Show the worked solution
A naive scan takes about n K (K minus 1) comparisons; a min-heap takes about n K log2 K. For 64 investors with 1,000 orders each, that is about 4.03 million against 0.384 million, roughly 10 times fewer. The heap holds only each list's current best order, so finding the next order costs a few steps down one branch rather than a look at every list.
What is the naive way, and where does it waste effort?
Imagine 64 queues at a bank, each already in order of arrival, and you must call people one at a time in overall order. The naive clerk walks along all 64 queue fronts every time to find the earliest. Every time one order leaves the book, the naive merge re-compares all K front orders, even though only one of them changed. That is K minus 1 comparisons for each of n K orders: 64,000 orders times 63 is 4,032,000 comparisons.
The other naive route is to merge lists one at a time: merge list 1 and 2, then merge in list 3, and so on. Each merge re-reads everything merged so far, which costs about n times K squared over 2, here about 2.08 million. Better than scanning, but it still grows with the square of K.
A min-heap keeps each investor's best remaining order, with the lowest yield at the top, so each step costs about log2 K comparisons; merging 64 lists of 1,000 orders then takes about 0.384 million comparisons against 4.03 million for scanning every front order. Why does a heap fix it?
A min-heapA tree in which every parent is smaller than its children, so the smallest item is always at the top and can be removed and replaced in a number of steps equal to the tree height. keeps the K front orders only partly sorted: the best is always at the top, and the rest are arranged so that fixing the tree after a change touches one path from top to bottom. Taking the best order and inserting that investor's next one costs about log2 K comparisons instead of K, which is 6 instead of 63 at K of 64. Total work becomes n K log2 K, about 384,000 comparisons.
The relationshipn orders per investor list, 1,000 K number of investor lists, 64 \log_2 K height of the heap, 6 for 64 lists What it says in wordsBoth methods output every order once; the heap makes each output cost the height of a small tree instead of a scan of every list.Say where the heap does not matter. With four or five lists, scanning is about as fast and simpler to code, and the orders arrive as fast as a person can read them anyway. The heap earns its place when K is large or the lists do not fit in memory, which is the version in the reported question: arrays read from disk, where only the front of each list is held at once. A careful heap counts about two comparisons per level on the way down, so treat log2 K as the order of the cost, not an exact count.
Where candidates lose it
The common miss is proposing to concatenate all the lists and sort them. It works, but costs about n K log2 of n K and throws away the fact that each list is already sorted, which is the whole hint in the question.
The second loss is naming a heap without saying what sits in it. Say clearly: one entry per list, the current front order, plus which list it came from so you know where to fetch the next one.
What the interviewer asks next
- What else does each heap entry need to store besides the yield?
- How would you merge the lists if they were too large to fit in memory at once?
- Two orders have the same yield. How do you keep allocation fair in the merged book?
Asked at Citadel, Equity Capital Markets, New York, 2026 (Wall Street Oasis):
I was asked to implement K-way merge of K sorted arrays
Asked at Citadel Securities, Equity Capital Markets, New York, 2026 (Wall Street Oasis):and the cadidate was expected to use a min heap
053Nine bond certificates look identical, but one is a forgery printed on slightly heavier paper. With a balance scale and only two weighings, how do you find the forgery?Syndicate desks
Try it first
What should the first weighing be?
Show the worked solution
Weigh three certificates against three, then one against one inside the suspect group. If the first weighing tips, the forgery is on the heavy side; if it balances, it is among the three set aside. Take that group of three and weigh one against another: the heavier one is the forgery, and if they balance, the third is. Each weighing has three outcomes, so two weighings separate nine cases.
Why split into thirds rather than halves?
Think of a quiz where each answer can be yes, no or maybe, instead of just yes or no. Every question now splits the possibilities three ways, so you get to the answer in fewer questions. A balance scale is a three-answer question: left heavy, right heavy or level, and a good weighing uses all three answers. Splitting in halves throws the level answer away, which is why it needs more weighings.
The first weighing of three against three sends each of its three outcomes to a group of three suspects, and the second weighing of one against one inside that group sends each outcome to a single certificate, so two weighings cover all nine cases. How do you prove two weighings is the minimum, and the limit?
Count the outcomes. One weighing has 3 outcomes and two weighings have 3 x 3 = 9, so two weighings can pick out at most 9 certificates, and nine is exactly what you have. One weighing cannot do it, because 3 outcomes cannot separate 9 suspects. The same count tells you the scale for any number: three weighings handle up to 27, four handle up to 81.
The relationshipw the number of weighings allowed 3 outcomes per weighing: left heavy, right heavy, level What it says in wordsEach weighing multiplies the cases you can tell apart by three.Now say why a DCM interviewer asks it. The puzzle rewards the habit of asking how much information each step gives before choosing the step. Due diligence on a bond issue works the same way: the best question to ask a management team is the one whose possible answers split the risks most evenly, not the one whose answer you already expect. The analogy is loose, so keep it to one sentence.
Where candidates lose it
Most candidates start with four against four because halving feels natural. If the scale tips, four suspects remain, and one weighing cannot finish the job, so they need three. The interviewer is waiting to see whether you notice the level outcome is information too.
The second loss is solving it but not proving two is the minimum. Have the counting argument ready: 3 outcomes per weighing, 3 x 3 = 9, and one weighing gives only 3.
What the interviewer asks next
- You now have 12 certificates and do not know whether the forgery is heavier or lighter. How many weighings do you need?
- What is the largest number of certificates you could search with three weighings?
- If two of the nine are forged, can you still find them in two weighings?
085You have two ropes. Each takes exactly 60 minutes to burn from one end to the other, but they burn unevenly, so half a rope does not take 30 minutes. With a lighter and nothing else, how do you measure exactly 45 minutes?Syndicate desks
Try it first
What is the one move that makes this possible?
Show the worked solution
Light rope A at both ends and rope B at one end at the same moment. Rope A burns out after exactly 30 minutes. At that instant, light the other end of rope B, which has 30 minutes of burn left. With two flames it finishes in 15 minutes, so rope B goes out at exactly 45 minutes.
Why does lighting both ends always give 30 minutes?
Two people painting a fence from opposite ends meet when the whole fence is painted, whatever the pace on each stretch; if the job is one hour for one painter, together they finish in half an hour. A rope's burn time behaves the same way: two flames consume the rope's 60 minutes of burn between them, so they must meet after 30 minutes, even though the meeting point is not the middle of the rope. Unevenness changes where they meet, never when.
Rope A, lit at both ends, burns out at 30 minutes; that is the signal to light rope B's other end, and the 30 minutes of burn left in rope B then finish in 15 minutes, at the 45 minute mark. Why does rope B have exactly 30 minutes left?
Rope B has burned from one end for 30 minutes, so 30 of its 60 minutes of burn are gone and 30 remain, spread unevenly along whatever length is left. Lighting its other end applies the same halving trick to what remains: 30 minutes of burn with two flames takes 15. 30 plus 15 is 45. The trick works on any remaining burn time, not just a whole rope.
The relationshipt one end burn time with one flame t both ends burn time with two flames, always half What it says in wordsTwo flames halve whatever burn time is left, so a half followed by a half of a half gives 45 minutes.Say what the puzzle is testing, briefly: separating what you know (total burn time) from what you do not (where along the rope that time sits). A desk reading a bond's cash flows faces the same split: the total is fixed, the timing can be lumpy.
Where candidates lose it
The common wrong move is cutting a rope in half and assuming each half burns for 30 minutes. The question tells you the burn is uneven precisely to rule that out, and an interviewer will stop you there.
The second loss is lighting both ropes at both ends at once and then being stuck with two 30 minute timers. Keep one flame on rope B back until rope A tells you 30 minutes have passed.
What the interviewer asks next
- How would you measure exactly 15 minutes with the same two ropes?
- With only one rope, which times can you measure?
- Using both ropes, list every time you can measure exactly.
