• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

Funny Quant story for Quant Apply @ Morgan Stanley

The people are lined up in alternating colored hats.

Congratulations, everybody dies.

i don't see how this would happen. second person is not to say the color of the hat of the one ahead of him. this is only for the first one. the second will just say what he heard. if he heard black, then his hat color is black and vice versa.
 
i don't see how this would happen. second person is not to say the color of the hat of the one ahead of him. this is only for the first one. the second will just say what he heard. if he heard black, then his hat color is black and vice versa.


You wouldn't get a job from this answer, that's for sure! What's the third person to do? in this way, you save 50% max! IlyaK8 did the right solution, although his reasoning was not perfect!

advice: think the solution through before you answer it - one thing is to come up with a solution, another one is to look it over, test if its correct and THEN redo it if it's wrong (which it is 9/10 times). that is when you have done well at an internship
 
i half-read the problem sorry. there was another problem on hats, at which once someone tells the color of the hat right, then the rest is to be saved. i mixed parts of each in one another while answering, which is exactly one of the mistakes that a job-applicant should not do, i think =).
 
since all prisoners are allowed to talk to each other and to set a strategy, mine would be this: the first one to be executed is to say the color of hat in front of him, so that the second shall know what to say. if there is n person, we have 1/2 chance to save all prisoners and another 1/2 to save n-1.

You are correct. But they have to agree before they line up that starting from the back of the line, the even numbered guys agree to say what the odd number guys said, while the odd number guys will just say what the even number guys hat colors are. As soon as they line up they have to make mental note whether they are odd or even.

The odd number guys are screwed. If they wear alternating colored hat, with certainty you save 1/2 of all prisoners and n=even, 1/2*(n-1) if n=odd.


And they are only allowed to say one thing after they line up, either "white" or "black".

Example just use 10 guys to break down the problem.

Because the last guy calls out 2nd guys hat color, he has 1/2 chance.

2nd guy calls out what last guy said. He is saved for sure.

3rd guy calls out calls out 4th guys hat color, he has 1/2 chance.

4th guy calls out what 3rd guy said. He is saved for sure

5th guy calls out calls out 6th guys hat color, he has 1/2 chance.

6th guy calls out what 5th guy said. He is saved for sure.

7th guy calls out 8th guys hat color. He has 1/2 chance.

8th guy calls out what 7th guy said. He is saved for sure.

9th guy calls out 10th guys hat color. He has 1/2 chance

10th guys calls out what 9th guy said. He is saved for sure.
 
This is like the most intense brain solver type of question I have ever heard.

FYI, there is a way to save all of the prisoners. A guy doing his PhD at UCSB actually did his research thesis on this problem and the implications of his thesis has relevance to algebraic coding theory or something like that.

You should look it up if you're curious. I was looking at the answer to the problem, and maybe I didn't think about it long or hard enough, but just looking at it for a little while, I felt like I needed a lobotomy. It is way intense.

You are supposed to answer a brain teaser at an interview that a guy did his PhD thesis on. Whoaaah.

There is also a way to save 99 of the 100 too. I guess the last guy takes a 50/50 shot while based on the last guys answer (everyone has to hear it), each guy in front just counts the number of odd or even white hats in front of him and decides if he is white or black.

Anyways, these problems are intense. What happened to how many golf balls you can fit in a plane or how many manholes are there in NYC.
 
Oh, you mean like how many candy corns are in a jar? A bit of counting and then applying a sanity test and I got second place and won a better prize than first. The first prize was the candy corns (ugh) and the second prize was a whole bag of fun-sized choco bars full of babe ruths and butterfingers and other such yummies ^_^

(They're procedurally trivial BTW)

The entire point of a brain teaser is like parallel parking for your driving test. Can you think? Can you establish a good process even if you don't arrive at the best answer? Can you get the *right* answer?

Cstassen, in my humility, I have to admit that when I first saw that problem, I was absolutely stumped. But the key is to learn from your errors and build on them, and to be always ready to say "I don't know".
 
If alternating hats, exactly half die, and they will be the guys who are odd numbered starting from the back where the warden does his execution yes or no.

samiam, you're not getting it right. all they have to do is say the even-uneven strategy as ilya describes. that's it, no other agreement is needed
 
samiam, you're not getting it right. all they have to do is say the even-uneven strategy as ilya describes. that's it, no other agreement is needed


Oh, I was just replying to Ilyak8's reply to Finmath's theory of way to solve the problem with only a minimum of 1/2 of the prisoner's getting executed with certainty. He said, if they were to switch the order of the hats with alternating B/W/B/W hats, then they would all die. I worked the problem out and verified Finmath's answer, and found out that switching the order of the hats would lead to exactly 1/2 being executed (and not all of them) and if the orders were not switched then there is at least a 1/2 being executed.

I saw the explanation for variation's of this problem. The 1/2 certainty was not covered but they showed explanations of 99/100 being saved with certainty and 100/100 being saved with certainty. So you are right about 99 out of 100 being able to be saved. B

But there is also a way to save all 100 of the prisoners, and looking at the answer to that one, if anybody in an interview were to be able to on his own come up with that answer, they would be statistically a mental outlier IMO. Because it took the guy to come up with that answer a PhD thesis to explain how to do it.
 
Oh, you mean like how many candy corns are in a jar? A bit of counting and then applying a sanity test and I got second place and won a better prize than first. The first prize was the candy corns (ugh) and the second prize was a whole bag of fun-sized choco bars full of babe ruths and butterfingers and other such yummies ^_^

(They're procedurally trivial BTW)

The entire point of a brain teaser is like parallel parking for your driving test. Can you think? Can you establish a good process even if you don't arrive at the best answer? Can you get the *right* answer?

Cstassen, in my humility, I have to admit that when I first saw that problem, I was absolutely stumped. But the key is to learn from your errors and build on them, and to be always ready to say "I don't know".

Yeah the teasers I mentioned were of the mgmt consulting variety where you don't have to be too much of a whiz to solve. I guess I tried to pick the easiest ones I could think of.

There were also how many times do you have to weigh using a balance scale to find out which balls out of 6 balls weigh differently. Two princes have to ride their horse on 3 day trek to a city, and the first horse that gets there inherits the throne to the kingdom. On the 2nd day of the horse, all of a sudden they ride as slow as possible. Why did they do this all of a sudden. I guess these one take an iota of more thought.

I also got the three doors with the prize on a commodities assistant trader interview along with with would you jump down into a 12 feet deep pool from 12 stories. Stuff like that. Didn't really see the connection between being able to solve these problems easily with trading well. I knew a guy who was a whiz at these teasers but he couldn't hack it as a trader and went into banking. I guess for quants it makes sense though.
 
Can you show a link to that answer? 'Cause I'd say that it is impossible to save everybody (non-full rank!)

Oh, I was just replying to Ilyak8's reply to Finmath's theory of way to solve the problem with only a minimum of 1/2 of the prisoner's getting executed with certainty. He said, if they were to switch the order of the hats with alternating B/W/B/W hats, then they would all die. I worked the problem out and verified Finmath's answer, and found out that switching the order of the hats would lead to exactly 1/2 being executed (and not all of them) and if the orders were not switched then there is at least a 1/2 being executed.

I saw the explanation for variation's of this problem. The 1/2 certainty was not covered but they showed explanations of 99/100 being saved with certainty and 100/100 being saved with certainty. So you are right about 99 out of 100 being able to be saved. B

But there is also a way to save all 100 of the prisoners, and looking at the answer to that one, if anybody in an interview were to be able to on his own come up with that answer, they would be statistically a mental outlier IMO. Because it took the guy to come up with that answer a PhD thesis to explain how to do it.
 
Samiam, by the way, everybody does not have to hear the first mans reply - they only need to hear the guy behind them's answer! Think it through
 
Can you show a link to that answer? 'Cause I'd say that it is impossible to save everybody (non-full rank!)

Definitely possible dude. By the way, these guys are prisoners. Unless they were scientist prisoners in a Siberian boot camp imprisoned for colluding with spies to reveal state secrets, I bet my life that no 100 prisoners would ever come up with a way to save all of their own asses!

Hat puzzle - Wikipedia, the free encyclopedia
 
This is a different puzzle - they can see all hats (mine only see hats in front of them), they can answer whenever instead of one at a time! and so on. but very clever solution (although clever i don't think it's that advanced - his thesis must have been a little more deep than that :D)

:dance: (dancing banana just for the hell of it)

Definitely possible dude. By the way, these guys are prisoners. Unless they were scientist prisoners in a Siberian boot camp imprisoned for colluding with spies to reveal state secrets, I bet my life that no 100 prisoners would ever come up with a way to save all of their own asses!

Hat puzzle - Wikipedia, the free encyclopedia
 
I hope I never have to get this kind of problem in an interview. LIke ever. Honestly, unless you get this exact problem, I have a hard time envisioning regular MFE grads unless they are Gary Kasparov's nephew to get this problem right by solving it in his head on the first time hearing it. Unless he has a sheet of paper and a few minutes or more to work it out. (I needed way more than that).

Ok, to get the 99/100 certainty, every guy in front of the last guy in line has to know not only what he says but also if he lives or dies. (Assuming the warden does the execution by going up each prisoner starting from the back, putting a gun to his head, and if the guy says black or white and gets it wrong, he pulls the trigger).

So we'll use 10 prisoners instead of 100 to make it simple.

Let's say the warden puts on 5 white hats and 5 black hats randomly on the 10 prisoners.

The last guy starts first. He will say white if he counts even number of white hats in front of him and black if he counts odd number of white hats.

Prisoner number, the color of his hat, and what he says:

#10, W, says W

(after the last guy says "White", the other 9 guys in front realize the warden didn't kill him so they know that he counted an even number of white hats and said white, but was not executed so he himself has a white hat. Now they all know there are an odd number of white hats, so that must mean there must also be odd number of black hats

#9, B, says B

(#9 counts even white hats in front and even black hats in front of him but knows #10 is white. So he must be black)

#8, B, says B

(#8 counts even white hats in front and odd black hats in front. But he knows #9 is black and #10 is white. So he knows he will be black because he adds up the three black hats he sees in front + 1 black hat called already + his own black hat = odd number of black hats)

#7, B, says B

(#7 knows there are 2 black hats and 1 white hat behind him. He counts even white hats and even black hats in front him. He know he must be black because he knows 2 black hats behind + 2 black hats in front + his own black hat = odd number of black hats

#6, W, says W

(#6 knows there are 3 black hats and 1 white hat behind him. He counts odd white hats and even black hats in front. He must be white because 1 white hat behind + 3 white hats in front + his own white hat = odd number of white hats)

#5, W, says W

(#5 knows there are 3 black hats and 2 white hats behind him. He counts even white and even black hats in front. He must be white because 2 white hats behind + 2 white hats in front + his own white hat = odd number of white hats)

#4, B, says B

(#4 knows there are 3 black hats and 3 white hats behind him. He counts even white and odd black in front. He must be black because 3 black hats behind + 1 black in front + his own black hat = odd number of black hats)

#3, W, says W

(#3 knows there are 4 black hats and 3 white hats behind him. he counts odd black and odd white in front. He must be white because 3 white behind + 1 white in front + his own white hat = odd number of white hats)

#2, B, says

(#2 know there are 4 black hats and 4 white hats behind him. He sees guy in front is white. He must be black because 4 black behind + his own black hat = odd number of black hats)

#1, W

(#1 knows there are 5 black hats behind him and 4 white hats. Duh. He must be white)



This problem will work according to whether or not the warden pulls the trigger on #10.

If he said White and he pulled the trigger, then they all know there are even number of white hats and there must be even number of black hats. If he said black and he pulled the trigger, then there are even number of white hats and even number of black hats. If he said black and he didn't pull trigger, then they all know there are odd number of white hats and odd number of black hats.

For 100 prisoners, it would be fair if the warden gave every guy a piece of paper and a pencil to keep track of the number of blacks or whites behind them.
 
This is a different puzzle - they can see all hats (mine only see hats in front of them), they can answer whenever instead of one at a time! and so on. but very clever solution (although clever i don't think it's that advanced - his thesis must have been a little more deep than that :D)

:dance: (dancing banana just for the hell of it)

Very clever answer. Took a thesis to do it. I would have never thought of it. And you're right if they didn't see the hats behind them, it's impossible to get all 100 saved.
 
No, they only have to hear if the guy behind them calls BLACK or WHITE (if everybody stickts to the strategy of course), and be able to see all hats in front of them. No more, no less. That's the way it is! You keep getting it wrong, saying that they need to hear all other peoples replies (only need to hear the one behind him) and knowing something extra. Redo your analysis from scratch i think, do a "game tree"
 
No, they only have to hear if the guy behind them calls BLACK or WHITE (if everybody stickts to the strategy of course), and be able to see all hats in front of them. No more, no less. That's the way it is! You keep getting it wrong, saying that they need to hear all other peoples replies (only need to hear the one behind him) and knowing something extra. Redo your analysis from scratch i think, do a "game tree"

What's the extra thing they need to know?
 
I'm not the sharpest knife in the ginzu shed. So I might be wrong. But with my solution for the 99/100 prisoners being saved, the solution works (as I worked it out). Albeit it may be unreasonable to think that all 100 prisoners must keep a tally starting from the back whether the count of black and white hats is odd or even. But it does work.

From my analysis, it seems impossible for each prisoner to guess the color of his own hat just by looking at how many black and white hats are in front of him while only knowing what the color of the guys hat behind him is.
 
Top