Interviewing with a top hedge fund is not dissimilar to interviewing with Goldman Sachs: you’ll usually be expected to attend multiple rounds of interviews and the process might be stopped at any point. But while Goldman Sachs has all but given up asking brainteaser style interview questions, hedge funds are still fully committed to putting people on the spot.

Based upon the questions recent interviewees have posted on Glassdoor, Citadel is one of the most challenging funds to interview with. Coincidentally, it’s also one of this year’s biggest hirers. Bridgewater Associates, which is widely known for its strangeness and asks all would-be hires to go through a personality test, also errs on the side of odd and complex questions. Brevan Howard is pretty pedestrian by comparison.

If you interview with these funds, here’s a sample of what you’ll need to be ready for.

1. In a 52 card game, you randomly draw five cards. You then return four cards back to the dealer and you keep one. The dealer will always know what card is in your hand. Can you tell me what strategy he used? * (Asked by Citadel)*

2. You are holding two eggs in a 100-story building. If an egg is thrown out of the window, it will not break if the floor number is less than X, and it will always break if the floor number is equal to or greater than X. What strategy would you use to determine X with the minimum number of drops in a worst case scenario? * (Asked by Citadel)*

3. For the years 1901 to 2000, count the total number of Sundays that fell on the first of a month. *(Asked by Citadel)*

4. How would you write a program to move inside a square spiral? Start at the upper left corner of the square and walk its edges clockwise. Just before re-approaching the upper left corner, spiral into the square instead, ultimately arriving at the center of the square. *(Asked by Citadel)*

5. Estimate the mass of the earth.* (Asked by Brevan Howard) *

6. You have a chess knight on a typical phone number pad, write an algorithm to enumerate the different numbers that knight can dial. (*Asked by Bridgewater)*

7. How would you calculate/assess the productivity of two ice cream salesmen across a 12 month period, where one takes 20 days of vacation in a row, and the other takes 20 days of vacation dispersed randomly across the year. (*Asked by Bridgewater)*

8. Design an algorithm to find the largest palindrome in a given string. *(Asked by AQR) *

9. How do you replicate a dice with flipping coins? *(Asked by AQR) *

10. If you could change something about yourself, what would it be? (*Asked by Bridgewater)*

11. Are designer babies ethical? (*Asked by Bridgewater)*

Follow @MadameButcher

**Contact: sbutcher@efinancialcareers.com**

## Comments (16)

What are the answers?

The cards are marked, or all the cards are the same. The answer to the egg question is X=1. Am I hired?

2. Drop the first egg from floors 0,k,2k,3k..nk (in that order) where k is a number, say, 10. Once the egg cracks at nk drop the second egg from (n-1)k, (n-1)k+1, (n-1)k+2..nk-1

Then k has to be found to minimise drops when there are a maximum 100 floors. From memory the inequality is k(k+1)/2 <= N .. solving the quadratic k is a little over 13, so optimal k is 14.

3. Approx answer is (2000-1901+1)*(12/7) (assuming 1901 and 2000 inclusive) (1/7 is prob that a random day is a given day, multiplied by the number of months in the year), or 171.

Specific paper answer requires a lot of messing around with leap year calulations and mods.

Otherwise:

#include

#include

int main() {

unsigned tally = 0;

for ( unsigned short year = 1901; year <=2000; ++year ) {

for ( unsigned short month = 1; month <= 12; ++month ) {

if ( boost::gregorian::date{year, month, 1}.day_of_week() == boost::date_time::weekdays::Sunday ) ++tally;

}

}

std::cout << tally <0 ; W-=2 ) {

unsigned x = startxy; // x=0, y=0 is upper left corner

unsigned y = startxy;

for( ; x < (startxy+W) ; ++x ) do_something_to_subsquare(x,y);

for( ; y startxy ; –x ) do_something_to_subsquare(x,y);

for( ; y > startxy ; –y ) do_something_to_subsquare(x,y);

++startxy;

}

2. Drop the first egg from floors 0,k,2k,3k..nk (in that order) where k is a number, say, 10. Once the egg cracks at nk drop the second egg from (n-1)k, (n-1)k+1, (n-1)k+2..nk-1

Then k has to be found to minimise drops when there are a maximum 100 floors. From memory the inequality is k(k+1)/2 <= N .. solving the quadratic k is a little over 13, so optimal k is 14.

3. Approx answer is (2000-1901+1)*(12/7) (assuming 1901 and 2000 inclusive) (1/7 is prob that a random day is a given day, multiplied by the number of months in the year), or 171.

Specific paper answer requires a lot of messing around with leap year calulations and mods.

Otherwise:

#include

#include

int main() {

unsigned tally = 0;

for ( unsigned short year = 1901; year <=2000; ++year ) {

for ( unsigned short month = 1; month <= 12; ++month ) {

if ( boost::gregorian::date{year, month, 1}.day_of_week() == boost::date_time::weekdays::Sunday ) ++tally;

}

}

std::cout << tally << std::endl;

}

result is 171.

4. It’s easy if you realise that one loop around the square is four strips of width-1 and that the next loop is just another square of width-2

unsigned startxy = 0;

for( int W = SQUAREWIDTH-1 ; W>0 ; W-=2 ) {

unsigned x = startxy; // x=0, y=0 is upper left corner

unsigned y = startxy;

for( ; x < (startxy+W) ; ++x ) do_something_to_subsquare(x,y);

for( ; y startxy ; –x ) do_something_to_subsquare(x,y);

for( ; y > startxy ; –y ) do_something_to_subsquare(x,y);

++startxy;

}

1. The cards are face up? :)

or they’re sorted.. then by getting four cards back the dealer has bounds on where to search for the missing card.

Ok, so the code was partly interpreted as HTML by the comments system and filtered out. There are entire statements missing (and the included headers in the other snippet). Nevermind.

6. Use recursion. Generate an array of 12 lists (one for each key on the keypad, [0-9#*]), list 0 contains {4,6}, list 1 contains {6,8}.. these are the next keys from the given key (assuming you can’t wrap around the keypad)). Then it’s a simple recursive walk to the depth of the number of digits in a phone number.

9. Generate a binary string from consecutive coin tosses – append a 0 for a head, and a 1 for a tail (or vice versa). Assuming the die is six sided the result of the virtual die throw is then the decimal value of this modulo 6 plus 1. The interviewer may then ask how many times to flip the coin (n_flips). Three times is wrong (it won’t be a uniform distribution of die results) – the answer is as many times as possible. The interviewer should then derive the error margin (off the top of my head it’s a function of 2^-n_flips).

7. Get stats on average daily ice cream sales over the last few years, or if not available, the average temperatures, day by day, over the year, (people buy ice cream when its hot) and the wet days distribution (people might not eat ice cream in the rain) and estimate sales. Ask whether the contiguous holiday salesman chooses the block at random, or if he deliberately chooses the least busy 20 day block. _Lost_ sales by random-days-over-the-year guy is 20*mean_daily_sales_over_the_year. Lost sales by guy who chooses contiguous block in Christmas (assuming northern hemisphere) is a much lower figure (who buys ice cream during Christmas?). If he instead chooses a 20 day block at random, starting on a different day every year, then lost sales approach 20*mean_daily_sales_over_the_year.

8. Sucky question – O(N^2) solution trivial, O(NlogN) less so.

O(N) I had to look up:

https://en.wikipedia.org/wiki/Longest_palindromic_substring

Manacher’s algorithm. Apparently. Took it someone 20 years to realise it. Doubt I’d get it in the interview.

11. What’s a designer baby? Is it a GMO baby that is born with an Apple/Prada logo on their forehead? Or just on the brain? Yeah, that answer will get you past the cultural fit stage of the interview :)

Or you could start by mentioning the difference between ethics and morals then go on to the effect on society, then maybe religion. But religion is best avoided at interview.

9!!. Damnit! Serves me right for rushing through them – the value of the die should be 1+floor(6*(decimal_value/(2^n_flips))). Using mod is obviously wrong as it ignores the additional entropy in the MSBs.

The error is 2^-n_flips. So by ten flips the error is 1/1024.

I’ll get my coat.

9. Last comment on this – both versions are actually fine although the errors manifest very slightly differently (different die values are more common in either case) – but the error margin is the same in both cases.

1+floor(6*(decimal_value/(2^n_flips))) should be quite a bit faster over 1+decimal_value%6, depending on compiler and architecture: the 6* and /(2^n_flips) can be converted to two bitwise shifts and one add, the %6 perhaps similarly, but less so.

9. I was thinking too much like a dev. From what I remember of stats you could also construct a bit string of 3-bits with the flips like before and if the value is not a valid die value (so if it is 0 or 7) keep shifting in new bits (dropping the MSBs above 3 bits) from the flips until it is. I _think_ that’ll be a uniform distribution then. My only problem with this method is the unbound execution time and all the conditional jumps.

The coin flips to dice can be done with an algorithm that terminates with probability 1.

If the first flip is heads, pick from 1-3, else 4-6.

Then flip until you get a tails, say it takes n tries (Not counting the flip from above). If n is even pick 1 (this happens with probability (1/4+1/16+1/64+…)=1/3). If n is odd, flip the coin again to decide between 2 and 3.