# Summer Intern Interview Questions

Summer intern interview questions shared by candidates

## Top Interview Questions

You are playing a game where the player gets to draw the number 1-100 out of hat, replace and redraw as many times as they want, with their final number being how many dollars they win from the game. Each "redraw" costs an extra $1. How much would you charge someone to play this game? 10 Answers10? redraw 10 times and get the payoff around 77? the average draw will pay out $50.50 Show More Responses Every time when you are deciding whether to play once more, we consider the two options: stop now, then you get current number (the cost of $1 is sunk cost); continue, then the expectation of benefit would be $50.50-1=49.50. This means, as long as you have get more than $50 (inclusive), then you should stop the game. Suppose the game ends after N rounds (with probability (49%)^(N-1) x 51%, and in the last round, the expected number is (50+100)/2=75, and thus the expected net benefit would be 75-N . This shows N<=74. Then we take the sum: $Sigma_{N=1}^{74} (49%)^(N-1) x 51% x (75-N), which is 73. All of the above answers are way off. For a correct answer, see Yuval Filmus' answer at StackExchange: http://math.stackexchange.com/questions/27524/fair-value-of-a-hat-drawing-game Yuval Filmus proves that the value of the game is 1209/14=86.37 and the strategy is to stay on 87 and throw again on 86 and below.. Let x be the expected value and n be the smallest number you'll stop the game at. Set up equation with x and n, get x in terms of n, take derivative to find n that maximizes x, plug in the ceiling (because n must be integer) and find maximum of x. ceiling ends up being 87, x is 87.357, so charge $87.36 or more I guess the question asks for the expected value of the game given an optimal strategy. I suppose the strategy is to go on the next round if the draw is 50 or less. Hence, the expected value of each round is: (1) 1/2*1/50(51 + 52 + ... + 100) (2) 1/2*1/2*1/50(51 + 52 + ... + 100) - 1/2 (3) 1/2^3 * 1/50 (51 + 52 + ... + 100) - 1/4 .... Sum all these up to infinity, you'd get 74.50. This is all very interesting and I'm sure has some application...but to trading? I don't think so. I own a seat on the futures exchange and was one of the largest derivatives traders on the floor. Math skills and reasoning are important but not to this level. I would associate day trading/scalping more to race car driving i.e. getting a feel for what's going on during the day, the speed at which the market is moving and the tempo for the up and down moves. If I were the interviewer at one of these firms, I throw a baseball at your head and see if you were quick enough and smart enough to duck. Then if you picked it up and threw it at my head I'd know that you had the balls to trade. I know guys who can answer these questions, work at major banks, have a team of quants working for them and call me up to borrow money from me because they're not making money. At the end of the day, if you want to be a trader then...be a trader. If you want to be a mathematician then be a mathematician. It's cool to multiply a string of numbers in your head, I can do this also, but never in my trading career did I make money because in an instant I could multiply 87*34 or answer Mensa questions which...realistically the above answer is: it depends on the market as the market will dictate the price. You may want to charge $87 to play that game but you'd have to be an idiot to play it. In trading terms this means that when AAPL is trading at $700 everyone would love to buy it at $400. Now that it's trading at $400 everyone is afraid that it's going to $0. Hope this helps. No offense to the math guys on this page, just want to set the trading record straight. |

Say I take a rubber band and randomly cut it into three pieces. What's the probability that one of the pieces has length greater than 1/2 of the original circumference of the rubber band. 9 Answers3/4 Suppose you have two cuts on the rubber band placed randomly. The probability of having one segment greater than half the circumference is the probability that the third cut will be inside the combined range of 90* to either side of the cuts. Since the average distance between the first two cuts is also 90*, the combined range is 270*, or 3/4 of the circle. You need 3 cuts to end up with 3 pieces. The first cut doesn't matter. The second cut can also be anywhere and the largest piece will still be at least half the circumference. What matters is the third cut, which should lie in the same half as the second cut. So the probability is actually 1/2. Show More Responses The correct answer is 3/4, as this problem is equivalent to the famous 3-points-on-semicircle problem. Why? If one of the pieces has length greater than 1/2 the circumference, then the three points of cutting must lie in the same semicircle. On other hand, if the three points of cutting lie on the same semicircle, then the longest piece must be at least 1/2 of the circumference. For reference to the 3-points-on-same-semicircle problem, see e.g., http://godplaysdice.blogspot.com/2007/10/probabilities-on-circle.html 1/4 1 -3/4 suppose I have two points whose minor arc distance is t <= 1/2. Then the range of semicircles covering both points gives an arc length of (1/2+1/2)-t = 1-t. say we fix the first point, tracing the second point around gives minor arc lengths from 0 to 1/2 and then 1/2 to 0. Therefore the answer is 2*integral (1-t) from 0 to 1/2, which is 2(1/2-1/8) = 3/4 It's 3/4. Cut it into 1 piece make a line. Cut it close. Pretend the length is 100. If you cut the first at x=1, as long as it isn't between x=50-51, it will have a length greater than 50% so there's 99% chance. You can imagine that if the cut was infinitely close to the end it would be about 100%. Now cut at x=2 you can't do between x=50-52. For x=3 it's 50-53 etc. So when you get to right to infinitely close to 50 it is pretty much between x=50-100 so there is a 50% chance you hit your spot. (obviously 50-50 is 100%, but since this length is continuous there's little chance it lands on that point). Obviously since this is symmetrical you can see this pattern going from 50% to 100% at the other end. Since each point on the continuous line has the same probability of happening the answer is clearly 75%. This problem is also equivalent to the probability that, if you have a line segment from 0 to 1 and you make 2 random cuts on that line segment, what is the probability that the three resulting pieces do NOT make a triangle? |

3) Poker. 26 red, 26 black. Take one every time, you can choose to guess whether it’s red. You have only one chance. If you are right, you get 1 dollar. What’s the strategy? And what’s the expected earn? 12 Answersexpected earn is 25 cents. 1/2*1/2*1, prob of choosing to guess is 1/2, prob of guessing right is 1/2, and the pay is $1 I would start picking cards without making a decision to reduce the sample size. This is risky because I could just as easily reduce my chances of selecting red by taking more red cards to start, as I could increase my chances of selecting red by picking more black cards first. But I like my chances with 52 cards, that at some point, I will at least get back to 50% if I start off by picking red. Ultimately, I can keep picking cards until there is only 1 red left. But I obviously wouldn't want to find myself in that situation so I would do my best to avoid it, by making a decision earlier rather than later. Best case scenario, I pick more blacks out of the deck right off the bat. My strategy would be to first pick 3 cards without making a decision. If I start off by selecting more than 1 red, and thus the probability of guessing red correctly is below 50%, then I will look to make a decision once I get back to the 50% mark. (The risk here is that I never get back to 50%) However, if I pick more than 1 black card, then I will continue to pick cards without making a choice until I reach 51% - ultimately hoping that I get down to a much smaller sample size, and variance is reduced, while odds are in my favor that I choose correctly. The expected return, in my opinion, all depends on "when" you decide to guess. If you decide to guess when there is a 50% chance of selecting correctly, then your expected return is 50 cents (50% correct wins you $1 ; 50% incorrect wins $0 --- 0.5 + 0 = .5) If you decide to guess when there is a 51% chance of selecting red correctly, then the expected return adjusts to (0.51* $1) + (0.49 * $0) = 51 cents. So, in other words, your expected return would be a direct function of the percentage probability of selecting correctly. i.e. 50% = 50 cents, 51% = 51 cents, 75% equals 75 cents. Thoughts? There is symmetry between red and black. Each time you pull a card it is equally likely to be red or black (assuming you haven't looked at the previous cards you pulled). Thus no matter when you guess you odds are 50% and the expected return should be 50 cents. Show More Responses scheme: guess when the first one is black, p(guess) x p(right) x 1=1/2 x 26/51=13/51 0.5, just turn the first card to see if it's red. I think it's more about trading psychology. If you don't know where the price is going, just get out of the market asap. Don't expect anything. The problem should be random draw card and dont put it back. Every draw you have one chance to guess. So the strategy is after first draw you random guess it's red. If correct you get one dollar, next draw you know there is less red than black. So you guess black on next draw. Else if first guess you are wrong, you guess red on next round. It's all about conditioning on the information you know from the previous drawings This should be similar to the brainteaser about "picking an optimal place in the queue; if you are the first person whose birthday is the same as anyone in front of you, you win a free ticket." So in this case we want to find n such that the probability P(first n cards are black)*P(n+1th card is red | first n cards are black) is maximized, and call the n+1th card? The problem statement is not very clear. What I understand is: you take one card at a time, you can choose to guess, or you can look at it. If you guess, then if it's red, you gain $1. And whatever the result, after the guess, game over. The answer is then $0.5, and under whatever strategy you use. Suppose there is x red y black, if you guess, your chance of winning is x/(x+y). If you don't, and look at the card, and flip the next one, your chance of winning is x/(x+y)*(x-1)/(x+y-1) + y/(x+y)*x/(x+y-1) = x/(x+y), which is the same. A rigorous proof should obviously done by induction and start from x,y=0,1. The answer above is not 100% correct, for second scenario, if you don't guess, and only look, the total probability of getting red is indeed the same. However, the fact that you look at the card means you know if the probability of getting red is x/(x+y)*(x-1)/(x+y-1) or y/(x+y)*x/(x+y-1). Therefore, this argument only holds if you don't get to look at the card, or have any knowledge of what card you passed Doesn't matter what strategy you use. The probability is 1/2. It's a consequence of the Optional Stopping Theorem. The percent of cards that are left in the deck at each time is a martingale. Choosing when to stop and guess red is a stopping time. The expected value of a martingale at a stopping time is equal to the initial value, which is 1/2. My strategy was to always pick that colour, which has been taken less time during the previous picks. Naturally, that colour has a higher probability, because there are more still in the deck. In the model, n = the number of cards which has already been chosen, k = the number of black cards out of n, and m = min(k, n-k) i.e. the number of black cards out of n, if less black cards have been taken and the number of red cards out n if red cards have been taken less times. After n takes, we can face n+1 different situations, i.e. k = 0,1,2, ..., n. To calculate the expected value of the whole game we are interested in the probability that we face the given situation which can be computed with combination and the probability of winning the next pick. Every situation has the probability (n over m)/2^n, since every outcome can happen in (n over m) ways, and the number of all of the possible outcomes is 2^n. Then in that given situation the probability of winning is (26-m)/(52-n), because there are 26-m cards of the chosen colour in the deck which has 52-n cards in it. So combining them [(n over m)/2^n]*[(26-m)/(52-n)]. Then we have to sum over k from 0 to n, and then sum again over n from 0 to 51. (After the 52. pick we don't have to choose therefore we only sum to 51) I hope it's not that messy without proper math signs. After all, this is a bit too much of computation, so I wrote it quickly in Python and got 37.2856419726 which is a significant improvement compared to a basic strategy when you always choose the same colour. dynamic programming, let E(R,B) means the expected gain for R red and B blue remain, and the strategy will be guess whichever is more in the rest. E(0,B)=B for all Bs, E(R,0)=R for all Rs. E(R,B)=[max(R,B)+R*E(R-1,B)+B*E(R,B-1)]/(R+B). I don't know how to estimate E(26,26) quickly. |

### Summer Intern at Five Rings Capital was asked...

• Is 1027 a prime number? • How would you write an algorithm that identifies prime numbers? • 2 blue and 2 red balls, in a box, no replacing. Guess the color of the ball, you receive a dollar if you are correct. What is the dollar amount you would pay to play this game? 6 AnswersAn algorithm for testing prime numbers is trial testing, test whether whether the number is dividable by an integer from 2 to its square root. For the color guessing game, the expected number of dollars you get is the average identity between a permutation of rrbb and rrbb, which is 2. For the prime number testing, only the number 2 and then odd numbers need to be tested. If it is not divisible by 2, there is no need to test against any other even number. So start with 2, then 3, then increment by 2 after that (3,7,9,...) until you are greater than the square root (then it's prime), or you find a divisible factor (it is not prime). To test for divisibility, we are looking for a remainder of zero - use a MOD function if available. Taking the integer portion of the quotient and subtracting from the actual quotient: if the difference is zero, then the remainder is zero and we have a divisible factor. If the difference is nonzero, then it is not divisible and continue testing. In this case, we find that dividing by 13 gives 79 with no remainder, so it is not prime. For the guessing game, the minimum winnings are $2 every time with the proper strategy. I'm assuming the rules are you pay to play and you get to guess until there are no more marbles. Say you guess wrong the first attempt. (you guess blue and it was red). So now you know there are 2 blue, 1 red. Your logical choice is to choose blue again, since there are more of them. But say you guess wrong again. Now you know there are 2 blue left, so you will win on both of the last 2 draws. If you were correct on one or both of the first two trials, then you could wind up with an even chance on the third trial, so you would win that some of the time, then you'll always win on the last trial. Show More Responses David, I think we could pay more that $2 and still come out on top. You logic seems sound, but looking at the probabilities I see: 1/2+1/3*(2)+2/3*(5/2) = 17/6 = ~2.83 Choosing the first ball, we obviously have an expected value of 1/2. Then, WLOG, we are left with RRB. Clearly we then choose R as this gives us a 2/3 shot at picking correctly. If it is R, then we get that $1, have a 50% shot at the next, and are assured the last, giving us, on average, $2.5. If it is B, then we know the next two will be R, giving us $2. As you can see, with an optimal strategy, we should expect to make ~$2.83 per round. Take the square root fo 1027. You get 32.04. Need only to check if divisible by prime numbers from 1 to 32, which include 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, and 31 For algorithm, see Lucas' test on Wikipedia, where there is also pseudocode. 1027 = 1000 + 27 = 10^3 + 3^3 and you know you can factor a^3 + b^3 |

25 racehorses, no stopwatch. 5 tracks. Figure out the top three fastest horses in the fewest number of races. 9 AnswersWe can do it in seven races, we'll call them races A-F. For notation, we'll say that the Nth horse in race X is called X.N. Races A-E: Divide the horses into 5 groups of 5 each such that each horse races only once. We can eliminate the slowest 2 horses in each of the five races because there are definitely 3 horses faster in each case. As a result, we eliminate 5x2 = 10 horses: {A.4,A.5,B.4,B.5,C.4,C.5,D.4,D.5,E.4,E.5} Race F: Race the fastest horses in each race A-E: {A.1, B.1, C.1, D.1, E.1}. To simplify notation, we'll label F.1 as horse A.1, F.2 as horse B.1, and so forth. That means the winner of this race is A.1, and it is the fastest horse of all. We don't have to race A.1 anymore. We can eliminate D.1 and E.1 = 2 horses. Because they are not in the top 3. As a result, we know that all remaining horses from D and E are eliminated. This is D.2,D.3,E.2,E.3 = 4 horses. We know that A.1,B.1, and B.2 are all faster than B.3 (and similar for C.3) so they are not in the top 3.We can eliminate B.3 and C.3 = 2 horses. Finally, we know that A.1 is faster than B.1, which is faster than C.1, and thus C.2, so we can remove C.2 = 1 horse. Race G: We have removed 19 horses from competition and are sure that A.1 is the fastest horse of them all. This leaves just 5 horses: {A.2,A.3,B.1,B.2,C.1}. We race them and select the top 2 to join A.1 as the top 3 fastest horses. just run them all on the one track :) one race, and you get your 3 fastest horses in one go........or am I missing something! 6 races. Divide 25 horses into 5 groups. Each group races and the fastest is selected. The winner of each of the 5 races all race together. Pick Top 1,2 and 3. My only concern: Could the answer be this simple? Show More Responses B, you're mistaken. Imagine the top three fastest horses are Santa's Little Helper, Yojimbo, and I'm Number One. By random luck, in your first race, the five random horses you choose includes all three of those. I'm Number One wins and goes on to the final race; the other two do not. 8 5 top horses from each race of 5 races (25 / 5) 5 top contenders race; 1 wins--that's one top horse (5-1) 4 remaining top horses race, one wins; that's 2 top horses (4-1) 3 remaining top horses contend; winner is #3 That's 3 top horses from 8 races Race#1 Race#2 Race#3 Race#4 Race#5 A1 B1 C1 D1 E1 A2 B2 C2 D2 E2 A3 B3 C3 D3 E3 A4 B4 C4 D4 E4 A5 B5 C5 D5 E5 Race#6 A1 B1 C1 D1 E1 Let's Say ranking 1st 2nd 3rd 4th 5th Eliminate D1 E1 D2 E2 D3 E3 A4 B4 C4 D4 E4 A5 B5 C5 D5 E5 Left with B1 C1 A2 B2 C2 A3 B3 C3 Eliminate C3 as there are more than three faster horses C2, C1, B1, A1 Eliminate C2 as there are three faster horses C1, B1, A1 Eliminate B3 as there are three faster horses B2, B1, A1 Left with 5 horses for Race#7 B1 C1 A2 B2 A3 So 7 races 7 races. put 25 horses in 5 group. and we will have 5 sorted list of horses in each group. put 1st place horse in each group, and we will have a sorted list X. X_1 is the 1st place horse, and X_2 is 2nd place horse's candidate, X_3 is 3rd place's candidate. 2nd place horse in X_1's group is candidate for 2nd place, 3rd place one is candidate for 3rd place. and 2nd place horse in X_2's group is a candidate for 3rd place. that's 5 horses in total, 2 from X_1's group, 2 from X_2's group, X_3. race them, and 1st place is 2nd place, 2nd place is 3rd place horse. 8 the answer is one race as the question doesn't specify all the horses have to run in separate races. |

2) A. 10 ropes, each one has one red end and one blue end. Each time, take out a red and a blue end, make them together. Repeat 10 times. The expectation of the number of loops. B. 10 ropes, no color. All the other remains the same. 7 Answers1/10 + 1/9 +...+ 1 ? B is similar.. 1/19+1/17+etc in B E[n] = 1/n + (n-1)/n*E[n-1] = 1/n + E[n-1] For the case of n=10, you would sum up all of the numbers from 1 to 10: 1/10+1/9+ 1/8 + 1/7 ... + 1/2 Show More Responses add an extra 1 to the previous answer For part A), the answer is 1+1/2+1/3+...+1/10. For part B), the answer is 1+1/3+1/5+...+1/19. Explanations: For part A), ctofmtcristo has the right approach but with a typo in the equation for E[n]. To obtain the expected number of loops, we note that the first red has a 1/n chance of connecting with its opposite blue end (and forming a loop) and a (n-1)/n chance of connecting with a different rope's blue end (and not yet forming a loop), so E[n] = 1/n*(1+E[n-1]) + (n-1)/n*E[n-1] = 1/n + E[n-1], with base case E[1]=1. Then, by induction, we get E[n] = 1+1/2+1/3+...+1/n. Part B) is similar. We note that the first end now has 2n-1 possible ends to connect to, of which 1 of them is its opposite end and 2n-2 of them belong to a different rope. Then, E[n] = 1/(2n-1)*(1+E[n-1]) + (2n-2)/(2n-1)*E[n-1] = 1/(2n-1) + E[n-1], with base case E(1)=1. By induction, E[n] = 1+1/3+1/5+...+1/(2n-1). Ed's anwser is not right. Just check for the case of 3 pairs. So total cases is 3!=6. 1 case with 3 loops, 2 cases with all wrongly attached, and 3 cases with 1 loop. so expected value is (3/6)*(1) + (1/6)*(3) = 6/6 = 1... and Eds anwser gives 1+1/2 +1/3 = 11/6, which is wrong clearly. Timi, you are missing the fact that if they are "all wrongly attached" then they form a loop. Similarly, the case you are thinking of "with 1 loop" actually has 2 loops. The correct answer is still 11/6. |

1) Tow coins, P(head)=1/3, P(tail)=2/3, design a way to get the effect of fair coin 5 AnswersI guess Play 2 games , TH or HT = outcome 1, TT = outcome 2 . Both of probability 4/9 disregard HH manipulate payouts. P(Tails) = 2/3, so if it lands on tails I get $1. P(Heads) = 1/3, so if it lands on heads you get $2. 2/3 * 1 = 1/3 * 2 We need unbiased decision out of a biased coin. Throw the coin twice. Classify it as "heads" if we get HT and "tails" if we get TH. Disregard the other two occurrences i.e. HH and TT. Show More Responses it's like you need to give heads another 'chance' (to double it's probability to match tails) if you get a tail, stop if you get a head, roll again and take the second result Swift and anon are both correct, but Swift's solution is twice as efficient because 8/9 of the time, Swift only requires 2 flips, while 4/9 of the time, anon requires only two flips. Indeed, for Swift, we can show that the expected number of flips is 2.25, while for anon, the expected number of flips is double that, 4.5. Let X be the expected number of flips. Then, for Swift, EX = 2 + 1/9*EX ==> EX = 18/8 = 2.25, while for anon, EX = 2 + 5/9*EX ==> EX = 18/4=4.5. |

### Summer Intern at Citadel was asked...

To write down code for x^n in O(logn) time. 5 Answerslinear: A^8 = A*A*A*A*A*A*A*A log: A^8 = (A^4)*(A^4) A^4 = (A^2)*(A^2) A^2 = A*A int power(int x, unsigned int y) { int temp; if( y == 0) return 1; temp = power(x, y/2); if (y%2 == 0) return temp*temp; else return x*temp*temp; } Time Complexity of optimized solution: O(logn) slightly optimized one: template T power(T base, unsigned int n) { if (0 == n) return 1; if (1 == n) return base; T tmp = power(base, n / 2); tmp *= tmp; if (0 == n % 2) { return tmp; } return base * tmp; } Show More Responses def powlogn(x, n): if x == 0: return 1 elif x == 1: return x elif n%2: return x * powlogn(x*x, (n-1)/2) else: return powlogn(x*x, n/2) Use Intel compiler, it does it automatically. |

If you have a calculator with only the number zero and every single operator, how can you get the number 24? 3 Answers(!0)+(!0) +.. so on You simply do: exp(0) + exp(0) + ..... + exp(0) , since exp(0)=1 therefore if you add 1 twentyfour times then you get 24. cos(0) also gives 1 |

How do the balance sheet and income statement relate? 3 AnswersBS flows to next BS through IS BS shows what you have as snap shot in time IS shows what you did with it over a period of time net income flows to the balance sheet as retained earnings |

**1**–

**10**of

**721**Interview Questions

## See Interview Questions for Similar Jobs

- Trader
- Intern
- Assistant Trader
- Trading Analyst
- Software Engineer
- Proprietary Trader
- Junior Trader
- Analyst
- Investment Banking Analyst
- Software Developer
- Associate
- Trader Trainee