 Feature Articles

CodeSOD
 Most Recent Articles
 A Caught Return
 Free From Space
 Zero Failures
 Lines of Code
 Limited Space
 Constant Adventure
 Mapro
 Shift Sign Off
 Error'd
 Forums

Other Articles
 Random Article
 Other Series
 Alex's Soapbox
 Announcements
 Best of…
 Best of Email
 Best of the Sidebar
 Bring Your Own Code
 Coded Smorgasbord
 Mandatory Fun Day
 Off Topic
 Representative Line
 News Roundup
 Editor's Soapbox
 Software on the Rocks
 Souvenir Potpourri
 Sponsor Post
 Tales from the Interview
 The Daily WTF: Live
 Virtudyne
Admin
Nobody seems to have correctly answered or even corrected an answer to this problem yet. In EnderGT's solution, the father still ends up on the same side of the river as the daughter, with the mother on the other side.
And obviously you could swap all occurences of (f,s) and (m,d).
Admin
I think the strategy should be if one player see two different hat should pass, this will give an information for the other two player that they are wearing different hat and should guess accordingly. if one player see same hat he should guess his hat is the same color. this will allow all players to guess correctly.
Admin
According to the logic you are supporting, if I flip two "heads" in a row, and then flip again, it will be a "tails" most of the time! Or if two of your friends flip the same, does that mean you will flip the other most of the time? Of course not. Try it.
Each coin toss (or hat colour) is independent of others.
Having said that, has anyone found a solution to the hats problem? The one person guessing with a 50/50 chance seems to be the best solution.
Admin
Hat Problem:
There are 3 people A, B, and C. A is the leader.
Strategy:
Only A (leader) will give the correct answer and other two will say PASS.
Even though other two have to say PASS, it is must for them to know the correct answer to get the $3M, otherwise they will loose it.
Consider, for B and C the rules for game is either all have same color or otherwise different. Which means if they see other two have same color their own is same, and they are going to get the $3M.
for A, if both B and C will see the same color they will be happy as they know the answer and going to get $3M. if either of them confused, he is seeing different colors.
if either of them is confused, the A is having the same color or otherwise he is having as others two.
Enjoy $3M ! manoj_ at hotmail
Admin
Well, I wasn't going to get into this again, but you seem fairly reasonable, so...
Each coin toss and hat colour is definitely independent of the others, yes  the "law of averages" argument about the coin tossing around page 8 or so is the other half of why this thread caused me to repeatedly bang my head off the desk. But the hats problem isn't as simple as that  it's changed because of the third option of not guessing at all, and the consequences of making a wrong guess against not guessing at all.
Without being able to communicate once you can see each other's hats, you need to decide on the conditions under which you're going to make a guess first. Once you make that guess, you're only going to have a 5050 chance of being right, naturally. And if you only guess the opposite colour when you see two hats of the same colour:
1 2 3 O O O  All guess and are wrong. X O O  #1 guesses "X" and is right. O X O  #2 guesses "X" and is right. O O X  #3 guesses "X" and is right. X X O  #3 guesses "O" and is right. X O X  #2 guesses "O" and is right. O X X  #1 guesses "O" and is right. X X X  All guess and are wrong.
This gives a correct answer for six out of the eight possible situations. You personally only have a 50/50 chance of being right when you make your guess, but there is a 6 in 8 chance of a situation coming up where this strategy will produce the right answer for all three.
Admin
Although actually, now that I look at it and the list of possibilities, I can't see why that would give any advantage over just saying "one person will guess". If a further condition was that everyone had to use the same strategy, then the answer above would make more sense  but they don't. All right, I give up. I should have done so some time around June, really.
Admin
Hints:
There are no guesses, it is 100% guranteed solution, if you don't consider capability to judge others expression is another way of communication, otherwise you don't need any strategy.
Admin
Correction: 5. The person who will decide will have same color as of person who know that other two have the different colors.
Admin
Cheesecake Factory asked me the same question, Are you a hapitual smiler? Guess what, I said what I am , not a hapitual smiler and wala, didn't get the job....They want people who keep showing their teeth all the time, no matter what.....Hey, there is a finger in soup....Oh, ya, showing with their habitual smile....what a bummer
Admin
Alternatively alternatively: http://en.wikipedia.org/wiki/Weight#Weight_and_mass
Admin
fill 3 litre. put it in 5 litre. again fill 3 litre jug., pour it to the rim of 5 litre jug, left is 1 litre in 3litre jug.,Now empty 5 litre jug, pour 1 litre from 3 litre jug to 5 litre and then 3 litres.
Admin
May not be the answer
I would like two of the three to tell the other hats color, I will be third person to tell the correct answer, that will be very easy !!
1  R R 2  B R (B  should be obviously 1st persons hat) 3  answer  the repeated one R
1  R R 2  R R 3  answer R (No other chance)
1  B R 2  B R 3  He sees BB/RR  then the ans is R/B
Admin
Arrrrrrgh. For one thing, I can't believe I just read most of those posts. For another thing, apparently if faced with the 3 hats problem, I would spend an infinite amount of time trying to convince at least one and probably both of the two other participants about what the rules are and the reasoning behind the strategy that has already been posted here dozens of times. So, we would never even finish our strategy session and get to the part where we put on the hats.
Admin
Admin
Anyone ever hear of a company named Trilogy in Austin? I made the mistake of interviewing with them several years ago before the dotcom bust. They made it very clear that they competed directly with Microsoft for the top people in the country. I got shuffled around from person to person, each with a smug look on his face and a stupid riddle to ask me. I vaguely remember on involving twelvepacks of soda where some of the cans were empty....and a seesaw or something. Hell, I dunno.
I finally asked if they were ever going to ask any real, relevant questions. I didn't get offered a job. I had already decided that I didn't fit in and wouldn't take a job there anyway. I DID get a very nice tshirt which I still wear to this day. I hear that they had massive layoffs a few years after I interviewed so it all worked out.
Admin
I don't know if you're stupid, or just ignorant. So let me explain it to you like you're a child:
These questions can be split into two categories  those which have an actual answer, and those which don't.
Those which have an answer are a good test of logical reasoning ability, and if your candidate is capable of deducing the answer then the chances are that he/she would have the aptitude to be a decent programmer.
Those which do not have a specific correct answer (such as the 747 question) give an interviewer a clear insight into the candidate's thought processes, which contributes to getting a clearer picture of the candidate's abilities.
Let me illustrate. Some years ago I was interviewed for a top software architect job at a hedge fund. I was asked how many telephone boxes there were in London. There is no 'correct' way to answer this question, but the answers I gave were:
(I got the job, but turned it down in favour of a higherpaying one elsewhere)
Clearly, since there is no correct answer, the score you get is up to the interviewer's subjective opinion  and since interviewers vary greatly, so will the score a given interviewee gets vary greatly depending on who the interviewer is. Moreover (as you noted) a miniindustry has sprung up around this interview approach, which unfairly boosts the ratings of incompetent cheats.
A large grey corporation with thousands of jobs to fill can clearly not get any consistency out of their interviewers; so, for the two reasons I set out above Microsoft decided to stop this kind of question  and NOT because it's a crap approach.
For a smaller company, a smart interviewer will get consistency (probably the boss man himself, interviewing all the candidates) and will mostly be able to spot the cheaters. (interviews are fairly varied after all!)
That article was nearly as bad as MFD! But keep up the ... err ... work. I'll be back to check up Error'd, occasionally.
Admin
Oh I forgot to mention  the Real WTF (TM) is the whole concept of the article. Did I mention it was nearly as bad as MFD? (which I notice is now conspicuously absent!!)
Admin
I guess we're fools. We always asked questions about... you know... programming.
Admin
Put a bomb next to an elephant on a fountain in NYC, and get a washedup alcoholic cop and a sassy black storekeeper to solve the problem for me.
Now that I think about it, that's an ideal solution to every one of these problems. Management, here I come!
Admin
The hat problem: they probably know that your strategy has a 75% chance of winning. So, they will do the only thing that is in their interest: give everybody the same color hat.
So, the strategy is: if you see the same color hats, choose that color. That way you will all be heroes!
Admin
A 747400 or a 747200?
"Arrgghhhhh!!!" (sound of interviewer being tossed into the Gorge of Eternal Peril).
Admin
Evidently Job Interview 2.0 is a lot older than people here realize. I interviewed with Polaroid back in 1976, and they were asking riddles at that time. Much easier than the Microsoft riddles, but nonetheless riddles. Probably people were dumber back then.
It just goes to show the old truism  Microsoft never really invented ANYTHING except Bob.
Admin
sounds like a good time for a binary search
Admin
And this is why we get programmers who like solving riddles, rather than programmers who like providing generic answers.
Which in turn is why programmers like programming languages which are like riddles, instead of programming languages which are lame.
Admin
Doing it using a binary sort takes four comparisons. Remember that the coin can be heavier or lighter than the rest. There's a way to do this using only three.
Admin
This is getting a bit of a revival, and there's a new topic as well, but I felt I had to answer the problem with the coins, except I am going to solve it with 12 coins (as one poster asked earlier) and 3 weighings and show it can be done.
The coins will be labelled ABCDEFGHIJKL. We have to determine not only which one is the rogue but whether it is heavier or lighter than the rest.
First weighing will be
(1) ABCD v EFGH
I will come back to what to do if they balance, but for now assume they do not balance.
Put G and H aside, weigh
(2a) ABE vs CDF
If on (1) the left hand side was heavier and it is still heavier, then the rogue must be one of ABF. So
(3i) weigh A against B. If one of them is heavier that is the rogue and the rogue is heavy. If they balance then the rogue is F and F is light.
(3ii) if the left hand side was lighter on both occasions then the logic follows in symmetry.
(3iii) if on the second weighing the scale tips the other way then one of the coins we moved is the rogue, i.e. one of CDE so weigh C against D with the same strategy as above.
(3iv) if the second weighing balances then the rogue must be G or H and we know from the first weighing if they are light or heavy so either way one against the other or one against any other coin and we know how we stand.
(2b) The scale balanced on the first weighing. Now this next one is tougher than it would seem but we just weigh IJK against any 3 of the first 8.
As the rogue must be one of IJKL, if the above does not balance we know that the rogue is one of IJK and whether it is heavy or light. So
(3v) weigh I against J and we know if they do not balance which one it is, and if they do balance it must be K.
(3vi) If on (2b) it balanced we know the rogue is L but we need to weigh it against any other coin to find out if it is heavy or light.
Note: with 8 coins we can do it in 3 goes with the same strategy as above, i.e. weighing all of them on the first go and follow steps 2(a) etc.
Now, a variation of the hats problem.
Suppose we change the rules so that all of them must make a guess. And all 3 must be right to win the prize. Once again their guess is simultaneous (i.e. they cannot know how the others have guessed) and there is no communication of any kind, in fact let's assume they do not even see each other, they just know the colours of the others hats.
Now please pick their best prior strategy.
I'll give you a hint: with a picked strategy they get a lot better odds than 1/8, though not as good as 3/4 we had before.
I may post this in the new topic too to get more response.
Admin
"Once they have had a chance to look at the other hats, the players must simultaneously guess the color of their own hats or pass."
Parsing is fun! You can pass at any time, but guessing must take place simultaneously.
Admin
Lol.. i would reject this software company before it rejects me.. how foolish can the corporate world get in the name of civilization?? :/
Admin
LoL.. ahmm.. that's a serious question!! :
Admin
Lol.. WTF Donations fund.. thats a good one.. ROTFLMAO.. heheheheheh..
Admin
Dude.. No matter how hard one tries and no matter how experienced one is, no human can perfectly judge another and that too in an hour! So that's the margin of tolerance there, to which many poor jobseekers fall victim!
Still, pretty good post here.. Well, Job Interview 2.0 makes sense only if "the interviewer" also has the requisite threshold intellect, that would be a lot higher than in case of a normal technical interview!
It's a game fellas; it can never be a sure shot coz the person questioning you is a human, and he might have read the same book as his interviewer!! ;)
You would never know.. :))
Admin
Everyone should use the following strategy:
If you see two different colored hats on your companions, then pass.
If you see two indentically colored hats on your companions, then guess the other color.
This results in a 75% chance of success.
The odds of all three hats being the same color are 1/8 for red and 1/8 for blue. Assuming you're in the other 3/4 then this strategy is a guaranteed win. Therefor you have a 3/4 chance of winning. [email protected] to dispute.
Admin
You're an idiot.
Admin
In this case you should follow these rules:
If you see two identical hats, guess that color. If you see two different hats, well... I was going to say guess randomly, but the person following the first rule will screw you up, so... too bad.
In this method you have a 25% chance of success. There might be a better method, but I don't see it immediately.
Admin
"at least one player guesses correctly and no players guess incorrectly."
Designate one person the "seer." Have him face one player if he sees mixed and the other if he sees same color.
The two other players can then easily say the color. Is the facing part "communication" though?
Admin
Fill up the 3 liter, empty into 5, Then fill up 3 again, emptying 2 into 5. You have 1 liter left in 3.
Empty out the 5. Fill the 1 liter into 5 Fill up 3, and empty into 5.
Round? Not surebut I guess it makes it harder for the cover to fall in? Like if they were square, they could fall at diagonals....
Take the chicken over, come back yourself. Take the fox over, come back with the chicken. Drop the chicken off and take the grain, come back yourself. Take the chicken back over, you're done.
Harder:
How do three people determine their average salary without any of them disclosing their own? (That is, there is no way of the other two knowing your salary by working backwards etc.)
You have 1 boat to cross river. Mom, dad, two sons, two daughters, a maid, and a dog. Rules: Dog will bite any family member unless maid is with him. Mom can't be left alone with sons Dad can't be left alone with daughters.
How do they get across?
Admin
This is happening at VMWare as well. Look what happened to their stock! When I interviewed in VMWare, the folks were simply NOT interested in knowing about my past projects, how I solved problems .... they had to ask latest algorithms like "Data Streams: Algorithms and Applications". Did you know, recently VMWare had a very embrassing critical timebomb licensing bug for which CEO Paul Moritz had to apologize.
Admin
How the hell did this hat stuff go unquestioned. Did half the respondents fail probability, or is it a joke? After all this time, people are still getting it wrong?
Conditional Probability. Look at Wikipedia.
If you observe that your two friends are both wearing Blue Hats there are PRECISELY two events that could have occurred. BBR or BBB.
Designate one person to guess randomly. Maybe they should guess the opposite colour and hope that the interviewer couldn't afford enough hats to buy 3 of each colour. Regardless, they need to pick one and everyone else needs to pass.
Admin
OK, I'm afraid I'm going to wade in. I know that several people have already pointed out the idiocy of the answers to the hat problem, but I just can't help echoing that sentiment. Some people are just incredibly stupid, ignorant, and arrogant with it.
The obvious solution is, in the strategy session, to designate a person to choose a certain colour. The other people agree to shut up. The team therefore has a 0.5 chance of winning.
However, I would like to note that the "no communication" rule is unenforceable. Imagine the situation. Everyone has agreed that Jack will say "blue", and everyone else will keep their trap shut. They go in the room, and realise that Jack has indeed been given a blue hat... or a red hat. Do you think that Jack will have any trouble telling what colour what he has? We're talking about people who know that they have just won $3 million... or failed to win it. Even if they are highly ethical, and do their very best not to cheat, I don't think that Jack would have any trouble distinguishing between an ecstatic group of people and a dismayed one.
Jack's chance of guessing correctly therefore rises above 0.5 even without cheating.
If they are totally isolated from one another, but are just allowed to see the colour of the other hats, then the probability is exactly 0.5.
The colour of the other hats is obviously irrelevant, unless Jack sees some kind of pattern (e.g. on 100 people, the colour corresponds to their sex, or everyone has a blue hat), in which case Jack should start to conclude that he has been lied to, and the choice is not in fact random; however, the problem as stated mentions only three people.
The problem as stated is far too easy, in fact, because of the strategy session. It would be much more challenging without it. It in effect becomes reminiscent of the Prisoner's Dilemma. Each intelligent participant knows that it is best for one person to guess, and the rest to shut up. Since they cannot coordinate, each should assume that they are in the "shut up" category. Guessing does not increase the chances of winning, because only one person needs to guess, and someone surely will. Intelligent participants in a large group will therefore keep silent, and a small number of fools will guess, and hopefully not guess wrongly. The trouble is when you find yourself in a very small group, such as the one mentioned here. It starts to be not at all unlikely that 100% of the other participants will have the same idea as you. This makes your strategy break down. Guessing when others guess halves your chances, but staying silent will take you out of the running if everyone does it.
I think I would guess if I had one or two partners. With three, four, five... I would have to decide based on my judgement of their intelligence (staying silent if I thought any of them stupid enough not to consider the possibility of staying silent). In a group of ten or more, I'd consider it almost a certainty that someone would guess for some reason, and therefore I'd shut up.
In any case, the guess itself is always random.
Admin
Did anyone answer the hat question already? the strategy is that b4 the meeting starts, they assign a task to each person. A will pass B will say out loud the color of C's hat (50 % chance of winning since it is either blue or red) C will repeat the color B said ...
That's the correct strategy right? if not, just give it grandpa...
Admin
If the players don't know what the others say, the first one might as well take a wild guess with the others passing (50% sucess rate). If, however, they know, the following should be done: a) If A sees one hat of each color, he should pass. B then knows that his color is different from C (which both see) and answer accordingly. b) If A sees two hats of the same color, he should guess having the opposite color (there being 8 combinations  with only 2 of them being monochromatic  his chances of success will be at 75%).
The chances of both a) and b) occuring will be at 50%, yielding an overall sucess rate of 87.5%
Admin
Correction: Instead of a random guess in case of simultaneous guessing, let those seeing two different colors pass and those seeing only one guess as having the other.
Admin
I can't believe I read that whole fucking thread. Some people truly are dense. To everyone saying 50% for the hat thing, have you changed your mind yet?
Admin
Actually, I know a blind man who liked to go biking with his wife.
Tandem bike. He sat in the back, of course.
Admin
I interviewed at a Software Company back in the 90's and was asked :
"How would you redesign a giraffe?"
My near immediate reply: "To what end do you want or need the giraffe redesigned? Do you have any sort of wish list or specifications or performance or new features you desire?"
After watching the interviewer stumble along going um uh um they finally replied make it easier to transport...
I commented that giraffes do a pretty good job of getting along on their 4 feet, was their a target transport device, plane, truck, boat, roller skates?
Again the interviewer stumbled and said car/truck.
Whereupon I said given that the anatomy and mechanical issues would have to be dealt with in detail after a final design change was selected here are some ideas, and I rattled off about 5 or 6 big picture type ideas.
I got an offer within the hour....
Admin
I remember the question "Why is the sky blue?" from my interview. However it was for a job in the space agency (which I got) and the question was asked to talk about physics with me so I found the question quite fair and interesting. ;)
Just to prove that it is not always about "how comfortable I am to admit that I don't know the answer."
Admin
So, it sounds like everyone's agreed that the best odds for the hat problem are 50%, right?
Admin
No, it is a hypothetcial question that is rooted in a non existant place. Ask a relevent question. I'm 35 and if I ever had tio deal with riddles I'd tell them that if this is how they choose applicants that i don't want to work there.
Admin
NJo, that's a science question. not a riddle. The answer is light diffraction.
Admin
got asked this in an interview last month  how would you figure out how many refrigerators there are in the state of wisconsin? was not pleased and did not accept their offer