• Fuz (unregistered) in reply to aardmoose
aardmoose:
Very nice... so simple...

The solution I came up with was a bit more obfuscated & relies on two's complement representation (although I think this is pretty close to the standard answer):

int f(uint32_t n) { int count = 0; while (n) { n = n & (n ^ -n); ++count; } return count; }

(The same as yours except for the "n = ..." line.)

Try this one for size (can't take credit for it... search for HACKMEM 169)

int num_bits_set(uint32_t n) { uint32_t tmp = n - ((n >> 1) & 0xDB6DB6DB) - ((n >> 2) & 0x49249249); return ((tmp + (tmp >> 3)) & 0xC71C71C7) % 63; }

Fair play if you can remember it in order to throw it out at an interview though.

• chuck (unregistered)

Manhole covers are round because manholes are round.

• Shim (unregistered) in reply to tastey
tastey:
.9999 (repeated) does not equal 1 for the exact same reason 1/infinity does not equal zero

Not true.

<lament>Why did they ever lower the mathematics standards for computer science?</lament>

Try this.

What is 1/11? (answer: 0.0909, repeating) What is 10/11? (answer: 0.9090, repeating)

What is 1/11 + 10/11? (answer: 0.9999, repeating)

As a fraction, what is 1/11 + 10/11? (answer, 11/11, or in simplest form, 1)

• ceeJay (unregistered) in reply to Zoe
Zoe:
The hat one is easy. Just call out the colour of the hat to your left ( or right, as long as everyone picks the same direction ). The chance of having two hats in sequence in this problem is 100%.

I'd like to point out that you would have failed by not being able to fully understand the problem given.

• mummey (unregistered) in reply to XML Hater
XML Hater:
Did M\$ start doing this after Google had their "IQ Test" job applications? Or was M\$ actually an innovator? ;-)

Microsoft innovated this, proving it was a dumb idea; but it had good intentions... ;)

Seriously though, they gave these to engineering students like myself. Out of ten occasions (yes! ten over my college "career"!) I solved it once or twice. By the last occasion I realized I had no interest in working for a company who put so much importance on these teasers, no matter how good their benefits may be.

Not long after I received an interview at silicon valley firm. I had only programmed on their platform on a couple of occasions, and I never used the progamming language they enourage. Despite this, they sent me an offer based ony my C++ skills and my interest in the area they were looking for.

No brainteaser bullshit. They hired me based ony what I could offer them and how well they felt I could work with the other members of the project team.

Now if only more companies did that... ;)

• 75Percent (unregistered)

And another one in Java

```import java.util.Random;

public class SeventyFive {

private static final int PARTICIPANTS = 3;
private static final int NUMBER_OF_DIFFERENT_HATS = Hat.values().length;
private static Random RANDOM = new Random();

public static void main(String[] args) {
int maxRounds = 10000000;
int wins = 0;
for (int round = 0; round < maxRounds; round++) {
wins += doRound();
}

double percentageWins = 100.0 * wins / maxRounds;
System.out.printf("%f\n", percentageWins);
}

private static int doRound() {
Hat[] participants = new Hat[PARTICIPANTS];
randomlyPutOnHats(participants);

int guesses = 0;
int correctGuesses = 0;

for (int currentObserverIndex = 0; currentObserverIndex < participants.length; currentObserverIndex++) {
Hat observerHat = participants[currentObserverIndex];
Hat fooHat = participants[(currentObserverIndex + 1) % PARTICIPANTS];
Hat barHat = participants[(currentObserverIndex + 2) % PARTICIPANTS];

if (fooHat == barHat) {
Hat guessHat = (fooHat == Hat.Blue) ? Hat.Red : Hat.Blue;
guesses++;

if (guessHat == observerHat) {
correctGuesses++;
}
}
}

return (guesses > 0 && guesses == correctGuesses) ? 1 : 0;

}

private static void randomlyPutOnHats(Hat[] hats) {
for (int hatIndex = 0; hatIndex < hats.length; hatIndex++) {
int hat = RANDOM.nextInt(NUMBER_OF_DIFFERENT_HATS);
hats[hatIndex] = Hat.values()[hat];
}
}

public enum Hat {
Red, Blue
}

}

```

Results:

```74.994130
```
• (cs) in reply to Shim
Shim:
tastey:
.9999 (repeated) does not equal 1 for the exact same reason 1/infinity does not equal zero

Not true.

Let's try this instead. 1/3 = 0.333... Yes? If you do the division, you see that it does. I hope we can agree on this.

1/3 + 1/3 + 1/3 = 0.333... + 0.333... + 0.333... 3/3 = 0.999... 1 = 0.999...

This is not trick mathematics, this is a fact.

• Konstantin Surkov (unregistered) in reply to dirkpitt!
dirkpitt!:
For those of you making it this far....Let's Make a Deal! This is an oldie but goodie, which has an answer that some people refuse to believe, even if you prove it with a handy program (like rbowes did with the hat riddle).

There are three doors (label them A, B, and C) that you cannot see through. Behind exactly one door there is a prize. Behind the other two are nothing.

You get to choose one door. The host of the show, Monty Hall, after you make your choice, does not show you if you chose correctly. Instead, he opens one of the other two doors. That door always has nothing behind it.

Now there are two doors unopened, one of which has a prize. He offers to let you stick with your original choice or switch to the other closed door.

What should you do (assuming you want the prize)? Does it matter?

Somebody has already mentioned this one before. And yes, you need to switch doors to double your chances.

• Tanglebones (unregistered) in reply to tchize

Anyone not willing to wait a day for the interview process for all candidates to complete is not worth hiring. I'd tell the candidate as much and ask if they are withdrawing or not. If they say yes I'd show 'em the door. Making unreasonable demands before you've even got an offer is completely unacceptable.

Of course the same goes the other way round. Any company not willing to let you think over an offer over night isn't worth working for.

• Merus (unregistered) in reply to Tanglebones

As far as I can see, brainteasers are a corruption of a reasonably sound idea. I originally heard the brainteasers as things more like 'how many gas stations are there in Los Angeles?' - they have no 'right' answer, so it's clear that no-one cares if you're off by a factor of ten. What they want to see is how you'd tackle an unknown problem, whether you'd dive right in and come up with a reasonable thought process or whether you'd just sit there and stammer.

The one I got in my interview had to do with compression schemes. The interviewer knew in advance that it was irrelevant and I didn't know much about it, which is the point - how do you respond to a question you don't know the answer to?

• Merus (unregistered) in reply to joe_bruin
Let's try this instead. 1/3 = 0.333... Yes? If you do the division, you see that it does. I hope we can agree on this.

1/3 + 1/3 + 1/3 = 0.333... + 0.333... + 0.333... 3/3 = 0.999... 1 = 0.999...

This is not trick mathematics, this is a fact.

Perhaps a good way to illustrate it is to find the result of 1 - 0.999... It seems to come out, intuitively, as 0.000...0001, but this result implies that repeating numbers have an end, and we just don't bother writing it - which is false.

It's perhaps easier to subtract 1.000... and 0.999... which works out to 0.000..., which is 0.

• (cs) in reply to NotanEnglishMajor
Rodyland:
- Why are manhole covers usually round? Round is the only shape that guarantees, no matter how you orient the cover, that the cover will not fall into the manhole and onto the man in the hole.

Half right. There are two shapes that won't fall in. Round covers won't fall in, and triangular covers won't fall in.

So the correct answer is: "The covers are round because they're easier to manufacture than triangular ones. (And easier to use, too.)"

• (cs) in reply to tchize
tchize:
Zoe:
The hat one is easy. Just call out the colour of the hat to your left ( or right, as long as everyone picks the same direction ). The chance of having two hats in sequence in this problem is 100%.
What if you are red and the guy on your left is blue, it's not impossible in this problem? And because you made a wrong guess, you team lost. Unless you suppose people arrange each other depending on what they see on each other's hat, but that imply some form a movement based communication, which is forbidden.

You probably forgot it's forbiddent to make a wrong guess. If you can make wrong guess and only a correct one is sufficient, i would agree with you :)

Only one person has to be right.

• Mania (unregistered) in reply to aardmoose
aardmoose:
Here's another... I don't remember where I heard it:

Given a random 32-bit integer, write some code that will count the number of set bits (i.e., 1's) in O(n) time, where n is the number of set bits. Use your favorite language that has bit-wise operators.

Hmm, I have no idea what the 'correct' answer is, but this is how I'd do it with branching:

Where eax holds the random 32 bit number on entry, and eax stores the result at the end.

``````mov edx, eax
xor eax, eax
@Loop:
bsf ecx, edx
jz  @Ret
shr edx, cl
shr edx, 1
inc eax
jmp @Loop
``````

@Ret: ret

Takes linear time + constant based on the number of set bits, as required. Here's how you'd do it without branching, and in constant time:

X := X - (X shr 1) and (\$55555555); X := (X shr 2) and (\$33333333) + X and (\$33333333); X := ((X shr 4) + X) and (\$0F0F0F0F); X := (X * \$01010101) shr 24;

Well, in pascal at least. I wrote the first function, the second one is from bit twiddling hacks.

• Slippery Jim (unregistered) in reply to Ben Olive

Yes, but no one can be wrong, and you all have to either guess or pass simultaneously, so you can't use the information from the other two's answer.

If you can take off the hat and look at it, then the problem is trivial.

If you can communicate a binary signal through non-verbal means, then you can let the other two know whether their hats match, and they can both answer correctly. For example, agree to sit down if the hats match.

If no communication whatsoever is allowed, then you might as well be in separate rooms, so use the strategy session to pick someone to guess, and have the other two pass. That gives you a 50% chance of success.

• Izzy (unregistered) in reply to MeMe

The seeing-eye dog sits in the sidecar.

• (cs) in reply to Slippery Jim
Slippery Jim:
If no communication whatsoever is allowed, then you might as well be in separate rooms, so use the strategy session to pick someone to guess, and have the other two pass. That gives you a 50% chance of success.

The bad news is, you need to put on the dunce cap.

The good news is someone should be along shortly to wear it in your place.

• Charly (unregistered) in reply to aardmoose

How about this? public static int BitCount(int x) { return ((x == 0) ? 0 : ((x < 0) ? 1 : 0) + BitCount(x <<= 1)); }

• Charly (unregistered) in reply to aardmoose

Here's another... I don't remember where I heard it:

Given a random 32-bit integer, write some code that will count the number of set bits (i.e., 1's) in O(n) time, where n is the number of set bits. Use your favorite language that has bit-wise operators.

How about this? public static int BitCount(int x) { return ((x == 0) ? 0 : ((x < 0) ? 1 : 0) + BitCount(x <<= 1)); }

• Charly (unregistered) in reply to Fuz
Fuz:
aardmoose:
Very nice... so simple...

The solution I came up with was a bit more obfuscated & relies on two's complement representation (although I think this is pretty close to the standard answer):

int f(uint32_t n) { int count = 0; while (n) { n = n & (n ^ -n); ++count; } return count; }

(The same as yours except for the "n = ..." line.)

Try this one for size (can't take credit for it... search for HACKMEM 169)

int num_bits_set(uint32_t n) { uint32_t tmp = n - ((n >> 1) & 0xDB6DB6DB) - ((n >> 2) & 0x49249249); return ((tmp + (tmp >> 3)) & 0xC71C71C7) % 63; }

Fair play if you can remember it in order to throw it out at an interview though.

public static int BitCount(int x) { return ((x == 0) ? 0 : ((x < 0) ? 1 : 0) + BitCount(x <<= 1)); }

• MEME (unregistered)

Well, manhole covers used to be square, but here in the U.S. we cut corners so often that they are just round now!

...a nice isosceles triangular 'cover'... whoops.. lost it!

• Shinobu (unregistered)

If anyone still cares, here goes: 0.999...

• Josh (unregistered) in reply to Flash
Half right. There are two shapes that won't fall in. Round covers won't fall in, and triangular covers won't fall in.

Well, it has to be a specific type of 'triangle', where the diameter is constant. (under those conditions, any odd-sided polygon would work just as well.)

cite: http://www.straightdope.com/classics/a1_247a.html

• MR (unregistered) in reply to TimS
TimS:
If someone shouts out the answer immediately, and recites the answer, as memorized, from a book of problems, that's an immediate check in the "no" column for me.

I knew the answer to one of the three brainteasers in the original article right away, because I had heard and solved it before, many years ago. My first thought of what I'd do if this had happened to me in a job interview was to tell the answer straight away ("turn on one of the switches, wait a while, turn it off, turn a second one on, leave it on, leave the third one off; open the box: the light that is off but warm belongs to the first switch, the light that is on to the second, and the light that is off and cold to the third") and then say I knew the answer and ask for another brainteaser.

I don't really like brainteasers, but that felt like the right thing to do. I could, of course, explain the background idea ("need to use more information than just light on/off, bla bla"), but this still would not really show the process of discovering the answer, and I agree with you that this process is really what the interviewer is looking for.

So, had I recited the answer from memory and then asked for another one, would I still have received an immediate "no" from you? ;)

• MR (unregistered) in reply to poochner
poochner:
And it's pretty obvious you don't understand what you're saying. Proof by example: strategy of "no one guess." Fails 100% of the time.

You can't prove by example. What you did is disprove by counterexample ;)

• (cs) in reply to Tim
Tim:
Well... what are the possible outcomes for the hat problem 000 001 ... 110 111

You see that 6 out of the 8 cases have two people with one color and one person with the other. If you bet on that, just guess the opposite color if the other two are the same color. Otherwise don't answer.

Those 8 cases aren't necessarily evenly weighted. (i.e. case 000 doesnt necessarily have the same probability as case 001).

The above table models the statement: "3 people can have one of two hats (R0 or B1)"

But not the statement: "3 people can have one of six hats (R1,R2,R3,B1,B2,B3), three of which are red, and the remainder are blue"

Writing a table for this statement is a lot bigger though, and I'm not good at stats. But from this snippet, you can see that 3 red hats is 3 times less likely to occur than 2 red and 1 blue (even though all hats are 50/50)... Hence in the above table, the event "000" has a lower probability than the event "001" (which, if anything, cements the existing strategy).

000 = 6/total outcomes R1 R2 R3 R1 R3 R2 R2 R3 R1 R2 R1 R3 R3 R1 R2 R3 R2 R1

001= 18/total outcomes R1 R2 B1 R1 R2 B2 R1 R2 B3 R1 R3 B1 R1 R3 B2 R1 R3 B3 R2 R1 B1 R2 R1 B2 R2 R1 B3 R2 R3 B1 R2 R3 B2 R2 R3 B3 R3 R1 B1 R3 R1 B2 R3 R1 B3 R3 R2 B1 R3 R2 B2 R3 R2 B3

• Shinobu (unregistered) in reply to ActionMan

Please read the riddle again. Specs, sweetheart, specs. And the importance of reading them carefully and thoroughly.

I felt it irrelevant to consider payload since it was not mentioned.

• ytb (unregistered)

3 men and hats ... at the initial strategy session you tell everyone that if they see two hats of different colours , they are to say "PASS" within 30 seconds of entering the room.

If you hear 1 pass , then your hat is the same colour as the person who said pass , If you hear two passes , then your hat is the opposite colour of the other two who have the same ...

If you hear no "passes" then you all have the same colour .

Easy . and 100% correct ..

I felt it irrelevant to consider payload since it was not mentioned.

My bad, meant to quote someone replying to my comments on the weight of an empty boeing 747

• (cs) in reply to aardmoose
aardmoose:
Oh boy... this is a fun day.

so...

let x = .999... 10x = 9.999... 9x = 9 x = 1

Or, for you more abstract thinkers, define x(n) as 0.999...9 (n 9's) consider lim((x(n)) as n -> infinity...

Ain't infinity fun?

I was trying to remember that, and proved the wrong wtf: [assume...] 0.999º = 1 [*10] 9.999º = 10 [-0.999º] 9 = 9.000º1 [/9] 1 = 1.000º1 [hence] 1 = 0.999º = 1.000º1 = wow!

I think this is what I was trying to remember: let x = 0.99º 10x = 9.99º 10x - x = 9 9x/9 = 1 0.99º = 1

• Shinobu (unregistered) in reply to ytb

Won't work - you have to give your answer simultaneously. This is easily enforced by forcing the participants to secretly write down their answer or forfeit their prize. Again specs. People seem to think a loophole is located here: "Each person can see the other players' hats but not his own." (to be rephrased like "Each person is allowed to see the other players' hats but not his own.") Not true. A) It may be possible that the players are physically restricted so that they really can't see their hats. B) "Can" also means "to be allowed to" as in "Can I ... ?" If you take your hat of, look in the mirror, etc., you're screwed. You could try to surrepticiously communicate, but you're screwed if caught. Also you may find communication to have been sufficiently resistricted by the quizmaster upon entry, in which case you need a backup plan.

you fail... the prize is only won if at least one player is right and none are wrong, using your strategy you will fail more than 85% of the time. Best solution strategy, if the other players hats are different colors pass, if the other two players hats are the same color, guess eh opposite color.

• Nauseus_Maximus (unregistered)

2 guys/2 girls/2 condoms - simple....send guy 2 out to get several more boxes of condoms, you have both girls with one condom each, when guy 2 gets back you both have them both as many times as you like! Hey, it didn't say ONLY 2 condoms :-D

How to move the mountain to the other side of the town - rotate the map 180 degrees! (much easier than relocating an entire town)

• Alex (unregistered)

I had a job interview recently and in it I was given one of these riddles. How high will the oceans rise if Antarctica melted?

I knew the answer off the top of my head (apprx. 190 ft) but my interviewer wouldn't let me off with just giving him the right answer, he wanted to know how I got it; sadly, "I just know" isn't a good answer. I tried to figure it out for him, but just the way he looked at me while I was talking about it made me irritated and I got frustrated. I thought for sure I botched the interview because of that.

• Hero (unregistered) in reply to Grandpa

Grandpa you better shove that code to yourself....and fuck off okie....shove it deep into your stinking asshole....I'm a real good programmer who was screwd by sonsofbitches like you.

• Mitchell T (unregistered)

You guys are like rabid rabbits on that hat problem. I am not touching that.

But the coin thing should be 2 or 3 measures. Since there are 8 coins with 2 possible values, eg: 0 or 1 that means 16 possible values.

2 or 3 guesses is all you need. This reminded me of matrix multiplication for some reason.

Assuming: We don't know if the coin is heavier or lighter than the others, just not the same weight as the other 7. Eg: we cannot asume that it will cause a result of higher or lower no matter what combination of coins we use. (50/50 rule is straight out) Why throw away the coins/data when you can use them/it to help prove the problem? :)

7 heavier 123 456 78 -> 123 456 equal 78 suspect 1 234 567 8 -> 234 higher 1 and 8 equal by being outside testing bounds. 7 is the only possible odd.

1 heavier 123 456 78 -> 123 low 456 high, 78 equal outside of bounds 1 234 567 8 -> 234 5678 equal, 1 is only one left.

3 lighter (worst case, just like if 2 or 5 was the odd coin) 123 456 78 -> 123 high 456 low, 78 equal 1 234 567 8 -> 234 high 567 low, same result, 145678 equal, 23 suspect 12 345 678 -> 345 high 678 low, 2 is now equal to the rest, 3 odd.

And the sex questions, eww eww eww, at least they could have rephrased the questions.

On a side note, wouldn't a manhole cover be fine if the rim of the hole was half or more of the distance than the object to be placed upon it?

What I mean is if we have a square manhole cover, say 2 feet x 2 feet, if the rim that holds it in place is .5 feet on each side, it works just as well as a circular cover.

A circle just makes this a bit less wasteful I would think.

• HoHum (unregistered)

I find it extremely ironic that a site which's purpose is to ridicule at other people's stupidity and incompetence is filled with this many idiots who can't read and understand simple instructions to a simple puzzle. This time the WTF is the comments not the post itself.

• t (unregistered) in reply to Skybert
Of course if matters. If you have more than 3 hats you might as well choose 1 person to guess. With 4 hats, following the same strategy, you'd get 16 possibilities; 2 wrongs (all hats the same color), 8 right answers (1 hat different from the other) and 6 'all pass' (the rest, eg. two hats of each color). That's a 50% chance of winning. With five hats, this goes down to 10/32, with six hats it's 12/64. With 3000000 hats, that's (3000000*2)/(2^3000000) which is just about 0% chance of winning.

Correct, but the strategy for 3 hats doesn't generalize naively to the case with more than 3 hats. You can do a lot better.

What you want for n hats is essentially a single error correcting code with codewords of length n with as many codewords as possible (i.e. 2^n/(n+1)). If you can do this perfectly (and you can if n is of the form 2^k-1, with a Hamming code) you succeed with probability n/(n+1).
The strategy is as follows: for each player, if the hats might form a codeword based on what they can see the other people wearing, they should guess the hat color opposite to the one that completes the codeword, otherwise they should stay silent. This has the desired effect of concentrating all the wrong guesses together (on the codewords) and spreading out the correct guesses (everywhere else).

For a concrete example, suppose 7 hats. Take the 16 hat distributions 0000000, 0000111, 0011001, 0011110, 0101010, 0101101, 0110011, 0110100, 1001011, 1001100, 1010010, 1010101, 1100001, 1100110, 1111000, 1111111. The assiduous reader can check that the other 112 hat distributions each differ in just one place from one of these 16. So this gives you a strategy that succeds with probability 7/8.

example, since my explanation's probably unclear: if the distribution is 0010001, then the middle guy sees 001?001 and so says 0, since 0011001 is in the list above. No-one else sees something which could be in the list, and so no-one else speaks, and the game is won.

• Shinobu (unregistered) in reply to HoHum
HoHum:
I find it extremely ironic that a site which's purpose is to ridicule at other people's stupidity and incompetence is filled with this many idiots who can't read and understand simple instructions to a simple puzzle. This time the WTF is the comments not the post itself.
You must be new here. :-) I swear, on practically every WTF, the comments are flooded with so-called solutions that are made of fail. As for the manholes, it has been noted before that in some areas square manhole covers are used to prevent theft. The manholes themselves however, are often round (presumably to prevent the cover from falling in). The shape of a manhole cover can be anything, even Hello Kitty-shaped. Although that would attract thieves with quite a lot more tenacity who are not discouraged by something trivial as not being able to roll it along. Perhaps round manhole covers are more efficient where material use is concerned, but other important factors may play a role as well. Most manhole covers I've seen were square or round with a kind of nob so they could only be laid down in one orientation. Does anyone know why that might be important?
• Shinobu (unregistered) in reply to Fuz
Fuz:
Fair play if you can remember it in order to throw it out at an interview though.
It's fairly easy to remember when you understand why it works. It's quite illuminating to work through an example on paper.
• Shinobu (unregistered) in reply to Fuz
Fuz:
Fair play if you can remember it in order to throw it out at an interview though.
It's fairly easy to remember when you understand why it works. It's quite illuminating to work through an example on paper.
• Lord Lucan (unregistered) in reply to Rodyland
Rodyland:
- You have a 3 litre jug and a 5 litre jug. How do you get exactly 4 litres into the 5 litre jug?

Multiple solutions are possible. Fill the 5 litre jar with water. Fill the 3 litre jug with the 5 litre jug. Now the 5 litre jug will have exactly 2 litres. Empty the 3 litre jug and pour the 2 litres from the 5 litre jug to the 3 litre jug. Fill the 5 litre jug and try to fill the 3 litre jug, since the 3 litre jug has already 2 litres, it will hold only a additional litre. Now the 5 litre jug will exactly have 4 litres

Rodyland:
- Why are manhole covers usually round?
Simple, a) They are usually very heavy (so that no one can easily steal them). Round shaped ones can be easily rolled on the ground for moving. b) A round shaped one will not fall inside the manhole at any angle. A square or a rectangular shaped one can.
Rodyland:
- You've got a chicken, a fox, and a bag of grain on one side of the river, and a boat that holds you and one of the chicken/fox/grain. If the fox is left alone with the chicken, he'll eat it. If the chicken is left alone with the grain, he'll eat it. How do you get all across the river so that nobody/nothing gets eaten.
Step1: Man takes chiken to the other side and comes back alone Step2: Man takes grain to the other side and comes back with the chicken Step3: Man takes fox to the other side and comes alone Step4: Man takes chicken to the other side.

I am a good programmer too:)

• (cs) in reply to Grandpa
Grandpa:
Three players enter a room and a red or blue hat is placed on each person's head. The color of each hat is determined by a coin toss, with the outcome of one coin toss having no effect on the others. Each person can see the other players' hats but not his own.

No communication of any sort is allowed, except for an initial strategy session before the game begins. 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. The group shares a hypothetical \$3 million prize if at least one player guesses correctly and no players guess incorrectly.

What strategy would you use?

(possibly someone already solved but I didn't have the time to browse 6 pages of comments :P)

Stand in a triangle, facing eachother. If you see a red hat to the left of you, be silent at first. If you see a blue hat to the left of you, say you pass. If the person to the right of you passes you have a blue hat so you say "blue", if the person to the right of you says nothing, say "pass"...

It's not 100% simultaneous, and it's not without communication per sé since being silent or saying you pass is a form of communication, but they observer might not notice and you'd walk away with \$3 :D

About posing riddles in an interview, I prefer to present candidates with a problem we have now or have had in the past and ask them for a possible approach towards the solution. It makes much more sense.

Coditor

• Khim (unregistered) in reply to Abraxis
Abraxis:
Bicycle for blind people? That's easy - tandem bicycle! (I've seen several blind people driving those - of course not in blind-pairs ;-))

No double-blind bicycles??

:)

(captcha: scooter - they trying to tell us something?)

• ms bob (unregistered)

It's not that the puzzle questions are a complete waste, but that they are an inefficient use of time. If you want to test for recognition of sorting algorithms or statistical filters or whatnot, there are plenty of real world example problems that could be used.

The problem with the puzzle questions is that their real purpose is unclear, which is not useful for either side of an interview. Interviewers who use them will give a variety of breathtakingly vague answers, which ought to signal the problem, but ego+habit is a tough combo to beat. I won't/didn't just walk out on such questions, but treat it like any interview question (why are they asking? what will they do with my answer? how can I use this to my advantage?). The questions do have a sort of cultural badge associated with them, as evidenced by the number of responses here, but that could easily be tested for with Sci-fi trivia questions and have the same relevance to the profession.

I work for the company that sparked all this, and some interviewers there still do this junk. I don't, but I'd give a "hire" to the answer in the OP if I did.

• sebmol (unregistered) in reply to TimS
TimS:
The answer to the riddle is irrelevant, really. What you're testing (and want to see) is the method in which the applicant goes about getting to the answer....
Thank you. I'm glad someone pointed that out after hours passed by with people trying to either guess solutions, tell each other how stupid they were or provide new riddles. It's not the solution you come up with but the process you take to get there. There's no way in the world you can measure a candidate's ability to program to the level of confidence you would need. What you can do though is to find out how they deal with new problems and whether they can be creative in finding a solution for it.
• Shinobu (unregistered) in reply to Lord Lucan
Lord Lucan:
Rodyland:
- Why are manhole covers usually round?
Simple, a) They are usually very heavy (so that no one can easily steal them). Round shaped ones can be easily rolled on the ground for moving. b) A round shaped one will not fall inside the manhole at any angle. A square or a rectangular shaped one can.
Believe me if I say people will nick anything, especially if it has trophy value. Weight is not really a limiting factor. Sometimes people find their car in a different parking spot than where they left them... did you ever wonder how that happens? And as noted above, the shape of the cover is irrelevant when it comes to cover-falling-in-the-manhole prevention. Oh and Coditor should have read the comments first. Or the question better - either would do. Perhaps we need a moderation system.
• (cs) in reply to sebmol

I too am amazed at the huge number of very vocal people here who absolutely refuse to bother with the actual requirements when working out a solution.

What's more interesting about all this is that these brain teasers actually give a chance to weed out the kind of people who should absolutely not be hired - the ones who, even when an exhaustive simulation shows that a particular answer works, continues to "disprove" it on some theoretical (dogmatic) grounds that he or she learned in statistics class twenty years ago, applied without taking everything into account. I mean, what are mere facts in the face of Knowledge? :)

• hmmmm... (unregistered)

(I'm posting this for nostalgic purposes, I also suspect that some of my ex-colleagues read this site, - might see you Friday ;-)

If I have 3 pieces of bread and I want to toast them on an old-fashioned grill, what's the quickest (most efficient) way of doing so ? The grill heats from above only (I want both sides toasted) and you can only fit 2 pieces of bread on it at a time.