Trader Interview Questions
trader interview questions shared by candidates
Top Interview Questions
Trader at Morgan Stanley was asked...
If two cars are traveling in a two lap race on a track of any length, one going 60 mph and the other going 30mph, how fast will the slower car have to go to finish at the same car to finish at the same time? 31 AnswersIt's impossible, the faster car will be done the race by the time the slower car finishes the first lap. the answer to this question lies on how long the race track, we can solve its mph if we know how long the track we be. Well, this is interesting because there are no track details and makes for multiple answers through ambiguity and assumptions. i.e. One could assume that it is a circular track and that the two lanes are very wide and that one car is on the outermost furthest from the centre and the other is on the track very near the centre. The circumference of each track therefore could be such that the faster car would have to travel twice the distance that the slower car has to and therefore the two cars would arrive at exactly the same time. The is why cares on a racetrack must start at offsets to each other or have their times corrected in some other way! In real-life, this is highly unlikely however it does demonstrate my point. Show More Responses I agree with the first answer (by the Interview Candidate). When the slow car completes the first lap, the fast will complete the second lap. It does not matter how fast the slow car goes on the second lap; it cannot win... 90 mph Wouldn't the slow car just need to go 60mph? It doesn't say that the fast car is going double the slow cars speed only that the slow car is going 30 mph and the fast is going 60mph. The question is a trick. It says how fast will the slower car have to go to finish "AT THE SAME CAR" to finish at the same time? It can go any speed!! It will always finish at the same car (2nd) at the same time. The car isn't changing!!! I'm assuming that the question, as typed, was entered incorrectly and that it should be worded, "How fast will the slower car have to go to finish at the same time as the faster car?" The answer is 30mph. Because that's how fast the slower car is going. Nowhere in the question does it state that the cars are at the same point on the track. The slower car is currently halfway between the faster car and the end of the race. The two pieces of missing info are: 1. How long is the distance of the track and 2. The distance that each of the cars has already traveled on the track. If you have that info then you can figure it out. The two pieces of missing info are: 1. How long is the distance of the track and 2. The distance that each of the cars has already traveled on the track. If you have that info then you can figure it out. I totally agree with wildfire. Did you just say, "If two cars are traveling in a two lap race on a track of any length, one going 60 mph and the other going 30mph, how fast will the slower car have to go to finish at the same car to finish at the same time?" WTF? Are you having a stroke? Try to raise both hands above your head. OK, now smile for me. And would you please try to say a complete sentence? The way the question is currently worded, it does not indicate any of the following: 1. Whether the two cars started at the same place, at the same time (we can infer "same place, same time" because it is a race), 2. Whether either car has traveled any distance at all (if yes, then how far; if the slower car has traveled one lap, then the faster car has finished, and if no, then the answer is 60 mph), 3. What is the shape of the track (to Alanjai's point, a regular track requires offset starting positions, whereas a figure-8 track with fixed lanes would not), and finally 4. Why the question is worded so poorly ("to finish at the same car to finish at the same time" ... I mean, come on, that's practically not even literate). Show More Responses Speed a = Car A speed = 60 mph b = Car B speed = 30 mph t = Time Elapsed (in hours) d = Race Distance (in miles) ((t * a) = distance traveled by Car A) - d = Distance Remaining Car A = dra ((t * b) = distance traveled by Car B) - d = Distance Remaining Car B = drb x= mph that Car B has to drive for the remainder of the race (drb/dra)= y y * a = x or ((t*b)-d))/((t*a)-d)) = y y * a = x Example: t = 1 hour d = 240 miles ((1 * 60) - 240 = 180 [distance remaining Car A] ((1 * 30) - 240 = 210 [distance remaining Car B] 210/180 = 1.666666667 1.666666667 * 60mph = 70 mph, the speed that Car B has to drive for the remainder of the race. oh, yeah... in case you couldn't guess, I'm a Digg user. oh, yeah... in case you couldn't guess, I'm a Digg user. I agree with wildfire. This question is not grammatical and is unsolvable as written. The point seems to be that you should read the entire question (review the entire problem) before jumping in to solve the question that is immediately apparent. So, attention to detail is important at this company. Assuming the question was mistyped into this discussion, and they want to know how fast the second car would have to go to finish at the same time as the first car, then the answer is: infinitely fast. The question is better expressed as: A car is driving a sixty-mile path at thirty miles per hour. At the half-way point, the driver wants to speed up so his average speed at the end of the path is sixty miles an hour. How fast does he have to go? At the half-way point (30 miles) he has taken one hour for his drive. To average 60 MPH, he would have had one hour for the entire road. Therefore he has no time left, and must travel infinitely fast (for zero time) to average 60 MPH. It doesn't matter what answer you give, it is how you come to your conclusion that counts here. There is missing information on purpose because they want to see how you solve problems, not if you can solve problems quickly. The cars, the track the speed doesn't matter, it is the questions you ask and the information gathering that counts. Since there are only 2 cars in the race, the race is over and the instant one of the cars passes the finish line. One car finishes first, the other finishes second by default. The answer is that it doesn't matter how fast either of them are going, or how long the track is. They will always finish at the same time (not to be confused with "finishing with the same lap time"). I agree with SteveC. Once the either car finishes, the race is over. The question was clearly misworded. If not, most of you would have failed. The best answers here are from toolbelt_1 and dadag. Morgan Stanley needs people with exceptionally strong quantitative abilities and communication skills. The interviewer gives you a vaguely worded question to see (1) how you would gather the rest of the information and (2) how you would use it. In the course of a real workday your manager, client or other stakeholder will rarely provide a perfectly well-defined request for information. In the heat of the moment, important questions are worded quickly and vaguely, yet your performance will be judged based on how well you respond. One of your most crucial job skills is determining true requirements through timely and effective follow-up communication, intuition and experience. Show More Responses Both cars will finish at the same time if the track length was 0. This is typical of Morgan Stanley. Search a bit more and read about the lack of communication and clarity within this company--and when the result is as it should be (wasted time and effort) they blame the lower level worker as Al did above. If you ask for more information, you get more of the same -- confusion. Al might ALSO work for Morgan Stanley and makes a flimsy excuse for wasted time in having to track down pertinent information for the task. He makes no mention of the increasing frustration, lost productivity and the poor underlings that take the blame for poor managers. There are a few upper level managers who communicate and instruct their reports very well. It is a breathe of fresh air. They will tell the report the objective, quick background and the task and then you go do it. That simple. Others have more time for backstabbing, gossip and slimy character demonstrations than instructing their reports. No wonder they will never catch up to Goldman Sachs. They just don't get it. it's quite easy guys, just think: 30 mph is the current speed x is the race lenght 60 mph is the target average speed so theanswer is 30*(miles raced/ total race) + speed to achieve*(iles missing/tot. race) = 60 speed = i know that yu can dothis.....;) I'm pretty sure this is how the question is supposed to be worded which makes Mike's response correct. If two cars are traveling in a two lap race on any length track, one going 60mph for the entire race and one going 30mph to begin the race, how fast must the slower car travel for the rest of the race once the faster car finishes its first lap to finish at the same time as the faster car? If this is the case then we can do the following. distance = rate X time let d = the length of the track. After the fast car completes one lap the slow car will have completed one half lap, or .5d So the fast car has d left to go and the slow car has 1.5d left to go. since distance = rate x time, and the fast car is going at 60mph, we have d = 60t where t is time. For the slow car, if we let x be the rate it will go (so what we're ultimately trying to solve for, we have 1.5d = xt. now substituting d = 60t in we have 1.5 x (60t) = xt Since the track has some distance, t cannot be zero so we can divide t out leaving 1.5 x 60 = x = 90mph. Hence the slow car would have to travel 90mph the second lap to finish at the same time as the fast car. Make it simple, it depend on the fast car, if fast car got no problem( like break down , flat tires...), it hard to pass. The slow car just got to wait, time and opportunity is the key. Car A - 30mph Car B - 60mph One Lap - X miles Car A will have to decide whether it wants to catch up before completing the first lap. Otherwise it's over. We have two missing variables. We can't solve it. The speed will be calculated based on car's A location. Car A has to accelerate at any point prior reaching X. For instance, at 1/2X miles Car A will have to travel 90mph to finish at the same as time as Car B. But at 3/4X it will have to go faster. So the closer it gets to reaching X, the faster it will have to drive. Let's say the track is 60 miles long. Car 1 has completed a lap of 60 miles after one hour, and car 2 has traveled 30 miles. For the second lap (which is one hour for Car 1 to finish), car 2 must travel 90 mph. This works with any distance; this one is the easiest to visualize. One or more comments have been removed. |
Trader at Jane Street was asked...
What is the sum of the digits of all the numbers from 1 to 1000000? This is different from the sum of the numbers. For instance the sum of the numbers from 1 to 10 is 55 whereas the sum of the digits is 46. 17 AnswersThe main idea is that if you write all the numbers from 0 to 999999 down as six digit numbers (possibly prepending zeros) then all digits appear the same number of times. So, its digit appears exactly 6 x 1000000/10 = 600000 times. so the result is 600000x 45 +1 (+1 for the number 1000000) Maybe I'm reading it wrong, but isn't the sum of the digits of 1-10 just 11? 1 digit for 1-9, 2 digits for 10-99? So it's 9+90*2+900*3+9000*4+90000*5+900000+6 no, I think the easy way to solve it in your head is to remember that when adding all digits 1 to 100, you have 50 pairs: 1+100, 2+99, etc. Each pair is 101, times 50 is 5050. 1 to 1000 would be 500500 so 1 to 1,000,000 would be 500,000,500,000 Pretty cool, huh? Show More Responses scott, dude you should add digits not the numbers, so 99+2 = 18+2 =20. not 101 Scott's answer from May 24 is the correct way to think about it if summing the numbers. The answer is 27,000,001 - if you do it programatically the operation is a simple map reduce - simply map a digit sum function across the list of values [1, 1000000] and then reduce an addition operator across the result. Python Proof: >>> sum(map(lambda n: sum(map(int, str(n))), xrange(1, 1000001))) 27000001 21085156 Don't mind the above answer. I read the question wrong. Each digit will appear 1+10+100+1000+10000+100000 times. so the answer is 111,111*45+1=4444440+555555+1=4999996 nb is right. Another way you can think about it easily is if you want the digits from 1 to 1,000,000 then each digit should appear 1/10 * 1,000,000 times. So 100,000 x 6 (for each place value) x 45 (the sum from 1 to 9) + 1 (for the 1 million) 27,000,001 I think John Doe is right. 27,000,001 is what I got. Think of each number as a 6 digit number. The average number each digit could be from 000,000 to 999,999 is (9+0)/2=4.5. Since the average of each number is 4.5 and there are 6 digits the average sum of the digits for a 6 digit number should be 4.5*6=27. There are 1 million numbers from 000,000 to 999,999 so the sum of the digits from 000,000 to 999,999 is 27,000,000. Subtract the digits of 000,000 which is just 0 and add the digits of 1,000,000 which is just 1 to get 27,000,001. For arbitrary a=1,...,9 accounts the how many a's appear in the six digit number. 1 * C(6,1)*9^5 + 2* C(6,2)*9^4 + 3 * C(6,3) * 9^3 + 4*C(6,4)*9^2 + 5*C(6,5)*9 +6*C(6,6) = 600000. 600000*(1+2+3+...+9)= 27000000. Then add the 1 from 1000000. The ans is 27000000. Show More Responses 2.7 x 10^7 + 1 general rule: to 10^n answer is 10^n * n * 4.5+1 here n=6, result is 27 000 001 1-1000000 same as sum of digits in 0 - 999999 then plus 1, treat 0 - 999999 as a 6 digit random number, then the digit of sum is sum of digit for each number: 1000000*(4.5*6)=27000000, so answer is 27000001. John doe is right each batch of 1-9 appears 10^(# before line times) i.e. 10000|0, 1-9 appear in the ones place 100,000 times, adding 100,000*45 to your sum. Thus we can write the sum 111,111 (1 for each place) *45 +1 |
Here is an example of a brainteaser during the interview: You have five pirates, ranked from 5 to 1 in descending order. The top pirate has the right to propose how 100 gold coins should be divided among them. But the others get to vote on his plan, and if fewer than half agree with him, he gets killed. How will the coins end up being divided, assuming all the pirates are rational and want to end up alive? 15 Answers54321 If the pirates are RATIONAL- then they would all agree with taking just 20 coins a peice and splitting it evenly. That is the short and sweet answer. Unfortunately these nerd interviewers may prefer a pointlessly long and drawn out answer to demonstrate your irrelevant mathematical reasoning skills/ability In which case you may answer with the following Give one coin each to the 2 lowest ranked pirates. and split the remaining between the top 3( Maybe 32 for the top pirate and 33 for pirate 2 and 3 ). The bottom 2 will certainly vote against you- but now atleast you are increasing your odds of the other 2 pirates agreeing with the plan. ( which are the 2 minimum votes needed for pirate one to survive) Obvious explanation If there are 5 pirates, one comes up with the plan and the other 4 vote. If fewer then half agree with the top pirate- he gets killed. That means if less than 2 agree he would get killed. He need at the minimum 2 pirates to agree with him to live. the answer isnt that obviouse.....you give the 3rd and 1st one coin and keep 98....start at the beginning. if theres 2 pirates, 100 for 2, 0 for 1 (one doesnt like this) If there is three 1 will be happy with just a single coin, b/c he does not want it to go down to 2. If there is 4 pirates, 2 will be happy with a single coin, b/c he does not want it to get down to 3 pirates where he will receive 0. So he gets 1 and 4 gets 99. At 5 it changes a bit. Here 1 and 3 will be happy with single coins b/c if it goes down to 4 they will receive 0 coins. So 5 takes 98, and 1 and 3 take 1 one each Show More Responses If there are 4 pirates and you give 1 coin to 2 and 99 to yourself....surely 1 and 3 will vote against you and it will go down to 3 pirates?? 0 to the lowest 2. 1/3*100 to the three others. half would disagree but the top pirate would live. highest rank keeps 98, two get 1 each, two receive nothing. now it's just up to the first two to be happy with 1 coin each, but then, if they were not, the other two would be more happy with 1 instead of 0 coins. one could argue that if all 4 are rational, they would demand 25 each or be unhappy alltogether. lol i hope that you are kidding....otherwise it's better to find a manual-farmer job.... btw sean is right sean is not right. The top pirate DOES NOT vote. If there are two pirates and the top decides to take the 100 coins for himself, the other one will vote against and the top pirate will be killed 98, 0, 1, 0 ,1 This is just a classic game theory question and you have to work backwards through it starting with the base case to understand the pirates motivation. If you have two pirates, p1 and p2, and if p1 is the final voter then he will always vote negatively unless p2 gives him all $100 since he can kill him anyways and take the whole loot. This means p2 is in a compromised position and does not want the game to go down to 2 pirates and will take any value greater than 0 from any other pirate, or will vote yes if he receives at least $1. When p3 is introduced, he knows p2 will need at least $1 to vote for the plan therefore he keeps $99 and gives away the last dollar to p2. This means p3 is in a dominant position and will vote down any plan that grants him less than $99. When p4 is introduced then he needs two of the three voters to vote for his plan. Granted p1 will decline unless he receives all of it and p3 will decline unless he receives at least $99 of it then he will give p3 exactly that and p2 $1 otherwise he is killed. p4 is in a compromised position so he will accept any offer where he receives something greater than 0. When p5 is introduced he knows p4 and p2 are screwed and the maximum they can earn if it bypasses him is $1. Therefore granting them each that money will guarantee their vote leaving the remaining $98 for himself and half the votes are positive thus he is not killed and gets to keep $98. So the distribution for p5, p4, p3, p2, p1 should be 98, 1, 0, 1, 0. If we assume that once the top pirate is killed the next one takes his place and decides how the money is allocated we can solve it like this: Five Pirates: || 34 || 33 | 33 | 0 | 0 | - pirates 4 and 3 make more than the 20 they should earn if the money is distributed equally and they should vote to pass while 2 and one vote against. Split 50/50 it should pass. BUT - could pirates 4 and 3 make more money if they voted against and then split it up among fewer people? Four Pirates: || 34 || 33 | 33 | 0 | - Again, everyone gets 33 and we assume pirates 3 and 2 vote in favor, outweighing pirate1. BUT - pirate 3 sees an opportunity Three Pirates: || 50 || 50 | 0 | - with only one vote to sway in order to get 50%, pirate 3 only has to give pirate 2 half of the total. So at best, pirate 3 will vote NO unless he gets his 50 up front. Pirate 4 will vote NO unless he gets his 34 up front. In order to survive, pirate 5 should pay accordingly to those pirates and take home a meager 16. Though 16<20, the other greedy pirates will always vote NO unless they get the amount they know they can receive. If Pirate 5 wants to stay alive that's what he'll do. TL;DR Pirate 5 - 16 Pirate 4 - 34 Pirate 3 - 50 Pirate 2 - 0 Pirate 1 - 0 Wait, that's wrong I just realized. The buck stops with pirate 3. He can get 50 and he will, so pay him 50 first. In the Four pirate scenario, Pirate 4 will also have to pay out 50 to pirate 3 or he'll be killed, so the most he can allot to himself is 17, which is all Pirate 5 should give him. New Tally: Pirate 5 - 33 Pirate 4 - 17 Pirate 3 - 50 Pirate 2 - 0 Pirate 1 - 0 Pirate 2 is always going to be looking for that $50 payday in the Three Pirate scenario, so it's important to neutralize his vote immediately by having 4 and 3 agree with 5 in the first place. If the top pirate gets killed, the rest of the pirates gets to divide the 100 coins which is 25 coins per person. but the higher ranking pirates 3,4 will probably get more so the best case scenario for pirates 1,2 is 25 coins per person. If the top pirates give 1 and 2 26 coins per person, they will vote for him and he gets to keep the rest of the 48 coins Show More Responses We have the following fundamental assumption: Any pirate will not vote down as long as his payout is greater or equal to that of what his payout would be with 1 fewer pirate. As such, we product the following chart, working up from 1 pirate: (Payout,Expected of 1 less pirate) , we require that (Payout >= Expected of 1 less pirate) to get their vote # pirates | Rank: 1 2 3 4 5 1 (100,) 2 (100,100)(0,0) 3 (0,100) (1,0) (99,0) 4 (1,0) (2,1) (0,99) (97,0) 5 (1,1) (0,2) (1,0) (0,97) (98,0) 20 each |
Flip a coin until either HHT or HTT appears. Is one more likely to appear first? If so, which one and with what probability? 14 AnswersLet A be the event that HTT comes before HHT. P{A} = P{A|H}P{H} + P{A|T}P{T} = .5P{A|H} + .5P{A|T} P{A|T} = P{A} therefore, P{A|H} = P{A|T} P{A|H} = P{A|HH}P{H} + P{A|HT}P{T} = (0)(.5) + P{A|HT}(.5) Therefore, 2P{A|H} = P{A|HT} P{A|HT} = P{A|HTT}P{T} + P{A|HTH}P{H} = (1)(.5) + P{A|H}(.5) 2P{A|H} = .5 + P{A|H}(.5) P{A|H} = 1/3 and P{A|H} = P{A}, therefore, P{A} = 1/3 So, HHT is more likely to appear first and it appears first 2/3 of the time. P{A|H} = P{A|HH}P{H} + P{A|HT}P{T} = (0)(.5) + P{A|HT}(.5) Need help - - why is P{A|HH} = 0 ? P(A|HH) = 0 because after a sequence of consecutive heads, you can no longer achieve HTT. The moment you get a tail, you will have the sequence HHT. This the reason HHT is more likely to occur first than HTT. Show More Responses P(A|HH) = 0 because after a sequence of consecutive heads, you can no longer achieve HTT. The moment you get a tail, you will have the sequence HHT. This the reason HHT is more likely to occur first than HTT. HHT is more likely to appear first than HTT. The probability of HHT appearing first is 2/3 and thus the probability of HTT appearing first is 1/3. Indeed, both sequences need H first. Once H appeared, probability of HHT is 1/2 (b/c all you need is one H), and probability of HTT is 1/4 (b/c you need TT). Thus HHT is twice is likely to appear first. So, if the probability that HTT appears first is x, then the probability that HHT appears first is 2x. Since these are disjoint and together exhaust the whole probability space, x+2x=1. Therefore x=1/3. You guys seem to be mixing order being relevant and order being irrelevant. If order is relevant (meaning HHT is not the same as HTH) then this has a 1/8 of occuring in the first 3 tosses. Also HTT has a 1/8 chance of occurring in the first 3 tosses, making them equally likely. Now, if order is not relevant. (so HHT and THH are the same), then this has a (3 choose 2) * (1/8) probability of happening in the first 3 tosses. The same goes for HTT (which would be the same as THT etc and others) so this has a (3 choose 2) * 1/8 probability of happening in the first 3 tosses as well. Either way they come out to being equally likely, please comment on my mistake if I am doing something wrong. Ending up with HHT more likely (with probabilty 2/3). HHT is more likely (2/3) probability. People with wrong answers: Did you not Monte Carlo this? It takes 5 minutes to write a program, and you can then easily see that 2/3 is correct empirically. I don't get it. Shouldn't P{A|HH} = P{A} in the same sense that P{A|HTH} = P{A} from both HH and HTH we have get the first H from HTT and so it should be P{A|HH} = P{A|HTH} = P{A} Am i wrong? sorry, i meant: I don't get it. Shouldn't P{A|HH} = P{A|H} in the same sense that P{A|HTH} = P{A|H} from both HH and HTH we have get the first H from HTT and so it should be P{A|HH} = P{A|HTH} = P{A|H} Am i wrong? Above link is the best solution I have seen for this problem http://dicedcoins.wordpress.com/2012/07/19/flip-hhh-before-htt/ Apologies, Below* Here's my answer. Let x = probability of winning after no heads (or a tail). y=probability after just one heads. z=probability after two heads. w=probability after HT. Thus x=(1/2)x+(1/2)y, y=(1/2)z+(1/2)w, z=1/2 + (1/2)z, w=(1/2)y. Therefore, z=1, y=2/3, w=1/3, x=2/3. We wanted x at the beginning, so it is 2/3 that HHT comes up first. Show More Responses Think of HHT as H(HT) and HTT as (HT)T For every occurrence of (HT) in a sequence of flips, there is a 1/2 chance an H occurred before the (HT) and a 1/2*1/2 chance a T occurred after. Thus, HHT is 2x more likely than HTT. HHT is first 2/3 of the time. |
If you flip a coin until you decide to stop and you want to maximize the ratio of heads to total flips, what is that expected ratio? 14 AnswersI think we could approach the solution in the following way let us say we get paid an amount equal to the ratio of no.of heads to total flips So, expected amount is: if we flip once:expected amount = (1H/1flip).P(H) + (0H/1flip).P(T) = 0.5 if we flip twice:expected amount = (2H/2flips).P(2H) + (1H/2flips).P(1H) + (0H/2flips).P(0H) = 1.(.25) + (.5)(.5) + 0(.25) = .5 and so on for each case we get the expected value as .5 and the answer should be (1/2) your strategy should be to stop once you see a head. 1/2 probability of getting a ratio 1/1. (1/2)^2 probability of getting a ratio 1/2 (because first flip must be a tail and second a head) (1/2)^3 probability of getting a ratio 1/3 and so on. I don't know the answer to the infinite sum though... Since the question asks you to maximize the ratio of heads to total flips, the answer should be: -1/2 + exp(1/2) - exp(-1/2) ~ 0.54 Show More Responses Suppose the event meets Poisson distribution. lambda is the rate P(event happens in one hour) = 1-e^(-lambda) = 0.84 e^(-lambda) = 0.16 P(event happens in .5 hour) = 1-e^(-lambda/2) = 1-sqrt(0.16)=0.6 The strategy would be to stop when you are above a 1:2 ratio, because that's what it will be in the long run. Stopping at a 1:2 ratio makes you neutral. It's not stopping at your first heads. What if your heads is 5 in? Then the ratio is 1:5. In the long run you can expect that ratio to be 1:2 as the limit goes to infinite. The answer should be 3/4 because there's a 1/2 chance you will stop at 1:1, the maximum ratio. The other half of the time you will play until the ratio approaches 1:2. So (1/2)(1/1)+(1/2)(1/2)=3/4. Stop as soon as you've soon more heads than tail, so... H + THH + THTHH + THTHTHH + ... E[H] = (0.5) + (0.5)^3 + (0.5)^5 +.... E[H] = 66/100 This is a random walk and i think it is recurrent. If you have infinite time you should at some point hit close to 1:1... hm, i don't like my answer infinity, if you get a head on the first flip, which had p=0.5, then ratio is 1:0, which is infinity... o.5 * infinity = infinity should not consider this position.... The answer is 3/4. It is NOT infinity because the question asks for the ratio of heads to total coin flips, not the ratio of heads to tails. The strategy is to stop whenever the total number of heads is greater than or equal to the total number of tails. If we get a head at the beginning, stop, and the ratio is 1. Otherwise, continue until we have equal amount of heads and tails, and we will end up with ratio 1/2 Consider the cases where we never stop, that corresponds to the subset of infinite sequences of coin tosses where at any given place, there are more tails than heads. Such a subset of events should have probability measure zero (Law of Large Numbers). Namely, if we keep tossing the coin, we are almost always guaranteed to reach the point where we have equal amount of heads and tails. Thus the expected ratio will be 1*1/2 + 1/2*1/2 = 3/4 Show More Responses The number should greater than 3/4 since if you get back to 1/2 ratio, you should keep flipping. The StackExchange shows the true answer of ~78%. I wonder what the interviewer considers the correct answer. Probably saying "a bit bigger than 3/4" suffices. One or more comments have been removed. |
Assistant Trader at Jane Street was asked...
Simulate a 6 sided die with a coin. 13 Answerssplit into two sets {1,2,3,4} {5,6} with one assigned to heads and the others tails. If in the {5,6} set flip again. If in the {1,2,3,4} set assign {1,2} to heads and {3,4} to tails. then split again. Toss three coins, we get 8 outcomes: HHH, HHT, HTH, HTT, THH, THT, TTH, TTT, for the first two, we toss again until neither HHT or HHT appears, for the remaining 6, we assign 1~6 individually. I propose another solution. Use 4 coins. Flip 2 coins together and separately another 2 coins together. Sample space for a 2 coin flip is: HH, TT, HT, TH (assume that HT=TH) For the two 2-coin flips assign value of dice, for example (column 1: 2 coin flip, column 2 other 2-coin flip) HH HH => 1 HH HT/TH => 2 HH TT => 3 TT TT => 4 TT HT=> 5 HT HT=> 6 with TH=HT Show More Responses With 1 coin, flip three times and HHH=1,HHT=2, HTH=3,HTT=4, THH=5, THT=6. If the first twice is TT, then abandon the first T and start with the second T. The candidate and William have problems. I think Ey's solution works. For the candidate's solution, you will get way more 5s and 6s, since fully 1/2 of the results will be either a 5 or a 6. Similarly, for William's solution, if you toss out results starting with HH, then you end up with ANY result that starts with a tail, and only half the results that start with a H. That means you will end up with more 3s, 4s, 5s, and 6s than you should. I think by simply changing what you throw out you could fix William's solution. If you threw out all HHH and all TTT you would be closer, but a solution where you don't toss out any data is still better. Nope. I'm a moron. Can't edit earilier post, but Ey, sorry, I gave you too much credit. Can't count HT and TH as the same thing because you get too many of them. No idea why I didn't see that 10 minutes ago. You can't map 4 coin results to three numbers fairly. You will end up with too many 2s and 5s and way too many 6s with your solution. Now we have no valid answers. I think someone proved it can't be done elsewhere. Interesting problem though. Toss 1: Heads=even, start with 2, tails=odd, start with 1 Toss 2: Heads=0, tails=2, add to total Toss 3: Heads=0, tails=2, add to total It cannot be done. The odds of any set of coin flips is always a power of 2, and there is no power of 2 for which 6 is a factor, because 6 factors to 2 * 3 and both are prime numbers. Eric, you're right, I thought my solution worked as well. My idea was that we do 2 independent 2-coin flips. Each 2 coin flip has the following possible outcome: HH, TT, HT(or TH, same thing). When combining the outcomes of the 2 independent 2 coin flips this is what we get: (1) HH (2) HH (1) HH (2) HT (1) HH (2) TT (1) TT (2) HH (1) TT (2) HT (1) TT (2) TT (1) HT (2) HT (1) HT (2) HH (1) HT (2) TT we get 9 possible outcomes, even if we set for example outcomes (1) HH (2) TT to be equivalent to (1) TT (2) HH, and similarly with others to get 6 outcomes, it won't work... HHH, TTT, start the process again. Assign the rest values of dice. HHT = 1 HTH = 2 HTT = 3 THH = 4 THT = 5 TTH = 6 Geez, they should really allow for nested responses for better discussions. I agree that with the approach first stated by William (except he had a typo, "HHT or HHT appears" should read "HHH or HHT appears" he was just referring to first two (or any two of the eight combination that one chooses not to assign values to). The way that "Do three flips" describes is clearer. Other approaches are problematic in that the chances of getting 1-6 are disproportionate leading to an unfair dice (for reasons that others stated). "Binary Thinkers" approach is also incorrect as for similar reasons. there 8 possible accounts (3 flips 2^3 = 8). Although it's a unique way to account for all the numbers 1 through 6... 3's are and 4's are precisely twice as likely to occur (2/8 or 1/4 chance) vs the other numbers (1/8 chance). You may ask for a probability of THHHHH if we get a consequent combination with 5 heads and one tail. Here are the 6 possible combinations: THHHHH HTHHHH HHTHHH HHHTHH HHHHTH HHHHHT so the probability of each is 1/6 Not a precise solution, but good enough for many purposes: Flip the coin a large number of times, interpret the result as number in base 2, and take it modulo 6. Some of the six numbers will be slightly disadvantaged, but you can make that difference arbitrarily small by increasing the number of coin flips. |
Junior Trader at Jane Street was asked...
During the third interview : imagine an infinite chess board. If the horse from 1 case, in how many cases can he possibly ends after 10 moves. You actually don't have to give a number but a 95% confidence interval. pen and paper allowed 13 Answers751 Don't really understand the question... the horse from 1 case? and whats the intuition of the answer given? I think it's much more than 751. I found 7938126 cases, and there are more. Show More Responses The answer is actually 741. I probably wouldn't have thought of this super quickly during an interview, but just think about it this way: in 10 moves, the most the knight can move to the right (or to the left) is 20 spaces. So you are confined to a 41-by-41 box of spaces. Now just label each column (or row if you'd prefer, as this is obviously symmetric) 0-40 (so the knight begins on the center square of column 20). Then just ask yourself....how many spaces in column 0 can the knight land on in 10 moves? How about column 1? And so on. If you think of it this way the answer will become clear. To "candidate" I suspect you are solving the wrong problem. If you're looking at possible paths that a knight might take then maybe I'd believe your answer. But for spaces to land on this is definitely wrong. By the way, since this is only a confidence interval, my friend had a very good way of estimating this. Each knight moves along the diagonal of a triangle with legs 1 and 2; in other words, the knight moves sqrt{5} away from the center with each move. So the spaces that the knight could land on would be roughly inside a circle of radius 10sqrt{5}, which has area about 1500. But the knight can only land on half of those squares because in an even number of moves he must land on a square that's the same color as the square he started on. So your estimate would be 750, so take some reasonable interval around 750. «wlfgngpck» I did it the way you said by giving half the area of the circus of radius 10*sqrt(5) so 750 is not bad for a true answer of 741 (or 751 I don't remember) Solution visualised : http://twitpic.com/9jegtb Formula (no idea why, but it works) x=amount of steps (square(1+4*x) + 1) / 2 - square(4*x) / 16 Range as square : ( 2x + 1 + 2x ) * (2x + 1 + 2x) = 41*41 = 1681 Add centerpoint : + 1 / 1682 Only half of the fields will be posible : / 2 = 841 Corners are not reachable, 1/8th of each direction without center lines : ( 2x*2x / 2 ) /8 = 100 Result 841-100=741 741 is too big, if the knight is at (0;0) can get to (20;10) in 10 moves but not to (19;9) in 10 moves...try it out with 2 moves...it's not 37 cases but only 33 because he can't get to (2;2) (-2;-2) (-2;2) (2;-2) in 2 moves... sorry I meant to write that he can't reach (14;14), of course he can reach (19;9) so my answer would be 741-4=737 cause he cant reach (14;14), (14;-14)and (-14,14) (-14;-14) no my bad, the can be reached 741 is correct, it's just in the case 2 that you have to substract these diagonals... he can get to 20 spaces in all 4 directions. thats 41x41 = 1681. he cannot reach the corners which are composed of 10 + 9 + 8...+2+1 boxes = 55. so four corners are 220 boxes. that leaves him at 1461. subtract one for the one he is on currently -> 1460 and divide by 2 bc he cant land on the opposite color from where he started. answer is 731 7n^2 + 4n + 1 for any n>1 |
Quantitative Trader at Jane Street was asked...
N points lie on a circle. You draw lines connecting all the points to each other. These lines divide up the circle into a number of regions. How many regions is this? Assume that the points are scattered in such a way as to give the maximum number of regions for that N. 14 Answersn choose 4 + n choose 2 + 1 I don't think the above answer is right.What happens if N is less than 4? Even if N is at least four, it still doesn't work For example, take the case when 4 lines are drawn, you can make 11 regions, but Dimitar's formula gives 4c4+4c2+1=8 The way you do it, is you start out with 1 region with 0 lines. Then you draw 1 line to get 2 regions. When the maximum number of regions is created, each new line will cross every previous line and will create a new region each time it crosses line. It also creates a new region just by being created. So the 2nd line makes 2 new regions, the third line makes 3 new regions, the fourth line makes 4 new regions etc. So the answer is the sum of the first N natural numbers +1. In general this is the formula N(N+1)/2+1 Hi, I also get Dimtar's formula, you may use the recursion method to do it, which takes some time. Is there any easy way to get this one? Btw, when there are 4 dots on a circle, I think it shoud still give 8 regions. I think 11 is the answer to another problem. If you make n cuts on a circle, the max shares you can create. Show More Responses I don't think that is correct. I can't see a way that, while obeying these rules, you can have 11 sections for 4 points. Perhaps the formula 2^(N-1)? i got 2^(N-1) as well 1 dot - 1 region 2 dots - 2 regions 3 dots - 4 regions 4 dots - 8 regions 2^(N-1), N greater than or equal to 1 The unanswered question (and the reasoning behind the combinations thing) is whether two adjacent regions may have the line that divides them ignored for counting up a them both together as a new region. Dimitar's way assumes you may erase a line and Mike's way does not. However, for Dimitar's way, I think the combinations do not just stop at the nC4 + nC2, but really keep going up to n (and Dimitar just stopped at ~6 when he was testing the base cases). Mike's way assumes each region cannot be made up of sub regions, which I feel is the more correct answer, since it gives a scalable answer without summation/set notation, though you should ask the interviewer which he'd prefer. Let's take the 3 dot example: Mike's thinking: =There's the middle triangle and the 3 arc regions, so 4 Dimitar's thinking: =Mike's + triangle + 1,2,3 regions =4 + 3C1 + 3C2 + 3C3 =4 + 3 + 3 + 1 = 11 which really seems to break down into: 2^n-1+summation(nC1->n). I dislike Dimitar's way, because it invariably includes the entire circle as a "region" that has been created, which seems to go against the spirit of the problem. Err, 2*n-1+summation(n-1C->n-1) This is a famous example in mathematics; it's often used as a warning against naive generalization. Here are the answers for the first six natural numbers: (# points) : (# regions) 1 : 1 2 : 2 3 : 4 4 : 8 5 : 16 6 : 31 Yes, 31. You can see, e.g., Conway and Guy's "The Book of Numbers" for an account of this. it is "Moser's circle problem" 1+nC2+nC4 srsly? draw 4 lines yourself and you can easily find its 11 The last answer should be 1+(n-1)*n*(n^2-5n+18)/24. At first I thought it's 2^(n-1), because for the first 5 terms it's really the same, but when n=6, it should be 31. Solution: I use recursion. Assume the number of regions for n points is f(n). If we add a new point, we can count how many new regions are created. 1. outside the polygon of original n points, create n new regions. 2. inside the polygon, once the line between the new point and original point cuts the original line, there will be one more region. Label the original points clockwise as 1 2 3 ... n, and the line of the new point with point i will cut (i-1)(n-i) lines. This number is the number of points before the points i times the number of points after the point i. Then how to calculate the sum of (i-1)*(n-i), i.e., sum(k)*n + sum(k*(k+1)). The first term is easy. The second term in fact is a question in the book Heard On the Street. First we guess it's k(k+1)(k+2)/3, and then use mathematical induction to prove it in an easy way. After all, I get f(n+1) = f(n) + n + n*(n-1)*(n-2)/6. And then use recursion and formula for sum(k^3), sum(k^2), sum(k) to get the last answer. Show More Responses mingda is correct One or more comments have been removed. |
Trader Intern at Jane Street was asked...
Russian Roulette - 4 blanks 2 bullets, all in a row. If someone shoots a blank next to you, would you take another shot or spin 12 Answerstake another shot, 3/4 chance of surviving vs 2/3 if you respin Here is my answer: the prob. of survival after re-spin is: 3/5. the prob. of survival with on re-spin is: 1/15 * 6/4 = 1/10. correction: the prob. of survival after re-spin is: 4/6. Show More Responses my final correction: the prob. of survival after re-spin is: 4/6 = 2/3 the spin with no spin is: 2/5 = c(4, 2) / c(6, 2). Denoting the blanks by 0's and live bullets by 1's, and adjoining the left and right edges (denoted by ~) , so as to make a cylinder, the following diagram illustrates how the bullets are arranged in the cylinder of the revolver: ~000011~ . Denote the bullet that is to be fired if the trigger is pulled by enclosing it in parenthesis. Denote an empty chamber by *. Assume that when you pull the trigger, the cylinder rotates clockwise (to the right in the diagram above). If when you pulled the trigger for the first time, the bullet was a blank, then before and after you pulled the trigger, the cylinder was and is in one of the following states: 1) Before: ~(0)00011~ After: ~*0001(1)~ 2) Before: ~0(0)0011~ After: ~(0)*0011~ 3) Before: ~00(0)011~ After: ~0(0)*011~ 4) Before: ~000(0)11~. After: ~00(0)*11~ If you pull the trigger again without spinning the cylinder, then only in case one will the bullet be a live bullet, yielding a 3/4 probability of the bullet being a blank . If you spin the cylinder and then pull the trigger, then you have a 4/6=2/3 probability of the bullet being a blank. Clearly, you should not spin the cylinder. don't spin, 3/4 prob survival if not spinned respin - 4/6 = 2/3 (obvious) don't spin - you only die if the blank was the "last" one, which is 1/4 chance. hence 3/4 chance of live. since 3/4>2/3 don't spin. Wouldn't play. Spin Spin: 4/6=0.6667 to survive Not Spin: C(4,2)/C(5,2)=3/5=0.6 condition on 2 bullet is in consecutive position and someone survives the 1st shot, we have: spin it-> survival rate is 4/6=2/3=67% not spin it-> survival probability=3/4=75% so...not spin it will have a bigger chance of survival. the question did not say that the bullets are next to each other so in this case you should spin I. Using Bayes' Theorem: P[0] = probability of a blank : 4/6 P[1] = probability of a bullet : 2/6 P[1|0] = probability of a bullet given a blank : find this P[0|1] = probability of a blank given a bullet If a bullet occurs then the next pull can be a bullet or a blank and so P[0|1] = 1/2 P[1|0] = P[0|1]*P[1] / P[0] = 1/4 So there is a 25% chance that the next pull is a bullet, or a 75% chance that it is a blank. The first pull had a probability of 8/12 of being a blank. Given a blank on the first pull, the second pull has a 9/12 probability of being a blank. II. From a frequentist perspective: So when the first pull is made and it is a blank the event space decreases from 6 possible outcomes to 4 possible outcomes. The first pull was on the last bullet or the the first pull was on the second to last blank. Out of the four possible events there is one where after the pull the chamber is sitting on the blank right before the bullet. Out of the four events 3 are blanks (3/4) and 1 is a bullet (1/4). |
Assistant Trader at Jane Street was asked...
You have a box filled with cash. Cash value is uniformly randomly distributed from 1 to 1000. You are trying to win the box in an auction: you win the box if you bid at least the value of the cash in the box; you win nothing if you bid less (but you lose nothing). If you win the box, you can resell it for 150% of its value. How much should you bid to maximize the expected value of your profit (resale of box minus bid)? 13 AnswersMy bad, I meant "0 to 1000" not "1 to 1000". Not that it affects the answer (hint hint). the expectation is always negative? bid 0. The expectation is negative. Show More Responses can someone explain why it is the case mathematically?? I thought your expected payoff is (0+1000)/2 x 1.5=750.. so if you bid 500. you will get expected 250 profit... Anon, If you bid 500 and it is worth 1, you only get paid $2 so you lose 498. $0 is correct. Generalize this for 1,2,5,10 maybe and find the EV of all those, or just 1,2,10, and then you will be able to "guess" that it isn't getting more and more negative and you should bid 0 you should bet 1, that is the minimum in the box, so you will win 0 or .5 if you bet one you'll never win. if you bet 500, you're missing out if value(box) >500 and <750 since those are +EV too. believe the answer is 749. The answer is bid 0 dollars. Soln: If you bid X dollar, you get the box if if it contains Y dollars, where Y < X. Or you nothing, which doesn't hurt anyway. Now think of possible values of Y in PAIRS, (0, X), (1, X-1), (2, X-2)... in each pair (a, b), expected payoff is P(Y being a or b) * E(payoff given Y = a or b). but the second term E(payoff given Y = a or b) = 1/2 (3/2 a - X) + 1/2 (3/2 b - X) = 3/4 (a + b) - X = (-1/4) X, which is always negative. If we sum over all possible pairs, we should get a negative number. Ofocz you need to handle the edge case, where X is small and the pairing does not really work. I think that since we are dealing with expected profit, we should ignore the case when n (our bid) is less than X (cash in the box) as nothing happens in this case. So we create a new distribution where X is uniformly distributed on [0, n]. Thus, E(Profit) = E(1.5X - n) = 1.5E(X) - n = 1.5*n*(n+1)/(2*(n+1)) - n = 0.75n - n = -0.25n <= 0. So the expected profit is maximised (=0) if n=0. Sorry, guys. I seem to have made a mistake in my solution above. Let X = cash value, n = our bid price. Then Profit = 1.5X - n. We want to find E(1.5X - n) = 1.5*E(X) - E(n). Now in order to find E(X), we notice that that X is uniformly distributed. So every outcome has a probability 1/1001. Also we only need to sum up over the values from 0 to n. Hence, E(X) = n(n+1)/(2*1001). For E(n), we see that we will pay the amount n with probability (n+1)/1001 and 0 otherwise. So E(n) = n(n+1)/1001. Therefore, E(Profit) = 1.5*n(n+1)/(2*1001) - n(n+1)/1001 = -0.25*n(n+1)/1001<=0. In order to maximize profit, we should bid zero. The answer is 0 if you ask me and here is the reason. let V be the value of the box and let x be your bid then you profit P is P=(1.5V-x)1_{V<=x}. we take expected value of this and use conditional expectation to get E(P)=E(1.5v-x|v<=x)p(v Answer is 2. The key is that the amount of cash X is uniform on (1,100) rather than (0,100). If we bid y money, then are expected value of profit P is E[P | bid y]=(\int_1^{y}(1.5-y)dx)/99=-(y^2-4y+3)/(4*99). Here the limits of integration are because P will be 0 if X is smaller than y, and we will get profit 1.5x-y if X=x and x<=y. Solving the maximum of this function gives y=1, with an expected profit of 1/(4*99)=0.0025. If the value was in fact from (0,100), then our expected value for any y would just be -y^2/(4*99) so we wouldn't want to play that. One or more comments have been removed. |
See Interview Questions for Similar Jobs
- Analyst
- Associate
- Junior Trader
- Software Engineer
- Quantitative Analyst
- Intern
- Financial Analyst
- Investment Banking Analyst
- Assistant Trader
- Vice President
- Business Analyst
- Consultant
- Software Developer
- Quantitative Researcher
- Quantitative Trader
- Director
- Trading Analyst
- Quantitative Research Analyst
- Research Analyst