 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
Two points:
First, I've seen a lot of the same mistake on the hat problem. The whole "X chances in 8" method of calculating only works if you have not seen the other hats. Think of it in terms of coin flips: the odds of flipping one head in a row is 1/2. It doesn't matter many heads you flipped before, the next one is still a 1/2 chance. Likewise, once you know what the other two hats are, your hat color odds collapse to a 1/2 chance of either color.
Second, I think I know why the brainteaser persists in the interview. It may not test programming skills, but it's an excellent conversation topic for programmers (135+ posts can't be wrong :).
Admin
I sure as hell wouldn't want someone who'll "figure it out" on his own when faced with incomplete requirements.
Admin
The answer to the Boeing 747 question, obviously, is look it up on Google. Uh, I mean Microsoft Live Search. Wait, I meant to say Live Search! Damn!
Admin
By not telling the other girl?
Admin
Just want to add my own thought on the hat thing because I was getting stuck with the probability of it.
I was pretty adamant that it was a 50% chance of being right with the hat problem because I kept on thinking "We have 3 independent variables A, B, C. Each has a probability of 50% of being Red or Blue. We randomly pick a spokesman and they guess."
But there's a different probability altogether that changes the odds. "What are the odds that two people have one colour hat, and that a third has the same colour hat?" and NOT "What are the odds that A has one colour hat, and B & C have the same opposite coloured hat". The only reason this works is because ANYONE can call out the answer, not just a prepicked spokesman.
So I kept on thinking, "Well if A has red, B has blue, and C has red then looking from A's perspective, I wouldn't say anything and just pass.", but if you turn it around and look at it from B's perspective he would call it correctly.
Going back to the tables and looking at the different occurances from A, B, and C's perspective should then show where the 75% comes from.
Admin
Admin
I've seen people like that. He's probably very clever, but he's arrogant. He wants to get his own way, and damn the cost to others. It's better not to hire blackmailing pricks like that. Tell him absolutely no deal.
Admin
"Do I contradict myself? Very well then, I contradict myself"  Walt Whitman
I just saw the flaw in my own logic. Your own hat color is independent of the other hats' colors. What is not independent is the total count of red hats. Now I vote for the "if two hats are the same color, vote the other, else pass" strategy.
The embarrassing part is that it's not the two semesters of probability I just took that convinced me, it's the guy who actually coded the thing up, ran his code and came up with 75.2%.
Admin
You know, usually I don't care for these long stories... But I gotta say, I really really liked this one for some reason.. :D
A friend of mine was asked all these ridiculous questions, ended up grilling me, I suck at puzzles, and yet after seeing the answers, remembered them. Later I had a Boss who fired off all these questions to a new potential employee. And he was as dumbfounded as I had been. But since I had seen these very same ridiculous puzzles before, as well as the answers that went along with them, I solved all the damn puzzles on the board in a few minutes. People were baffled. So I had to tell them.. "I've seen 'em before. Already knew the answers."
Funny to think that someone's potential new job hangs in the balance based off of "how do you connect all the points using only four lines". Yeah, what a way to determine the quality of your dev team... (Although I'd like to think we turned out alright)
Admin
This isn't a stupid question. The question is to see how you attack a hard problem with no trivial solution.
The interviwer doesn't care what the actual answer is. He wants to see how you come up with the answer, and does it make sense.
Let me mention some of my stories. I used to interview college students on campus. One question I asked was "How many blades of grass are on campus." One person, who went to school there for 4 years, said there was no grass on campus! No hire, not very observant. Another person said he would pick a sqaure yard and count the number of blades in that square. Even after I pointed out the flaw, he never changed to picking several squares. He as adament... Until I pointed to the nice clean floor and said, what about that square.
What was I looking for? I didn't really care what number you came up with. But anyone who'd been going to school there for even a semester should have an idea of how many lawns there are, and give a wild guess how much ground was covered by grass. Then maybe estimate a blade of grass was .01mm by 3mm (or whatever) and do some math and come up with a large number. The math didn't have to be perfect, but it had to be reasonable, and make sense.
In school you are generally taught to solve easy problems (well the problem might be difficult, but its still straightforward) A train leaves point A and 50 mph, and another train leaves point B, blah blah blah... But how well do you deal with oped ended problems that don't have a real solution.
Admin
It's hard to argue with results.
Admin
In the "canonical" question and answer, half constitutes a majority, so #2 can keep all 1000 coins. But yeah, the approach is right.
Admin
For the condom problem, if you're not concerned for the safety of the women, you only need one condom. If you are concerned, then it's impossible with less than 3 condoms, unless you can wash the condoms. Assuming disease can transfer from condom to condom as well.
Admin
No Hire. Candidated can't tackle ambiquious problem, instead points out other peoples failure.
But seriously, the company is hiring you to solve problems. Not on how well you can lie on a resume. What? You didn't lie on the resume, how do we know without asking you questions?
I start my interviews off by asking someone to tell me about a favorite project they worked on. This guy told me about an XML parser he just wrote. Then I asked him to write code for strcmp. Not only could he not write strcmp, he didn't understand the concept of COMPARING TWO STRINGS! How do you write an XML parser, if you can't understand how to compare strings?
By the way... The subject of the job is to solve problems. Perhaps you should study up on it next time.
Admin
Anyone memorizing scripts of how to pretend to think through brainteasers is obviously going to fail some other aspect of the interview.
Admin
Or fill the 3L jug. Pour all from the 3L jug to the 5L jug. Refill the 3L jug. Pour from the 3L jug to the 5L jug until it's full. Empty the 5L jug. Pour the remaining 1L from the 3L jug to the 5L jug. Fill the 3L jug. 3L + 1L = 4L.
captcha: muhahaha, now the captcha wasted your time too!
Admin
Admin
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?
Admin
E) You inform him he's not as selfimportant as he thinks and ask that he only comes back after learning humility.
Admin
Rephrased... Initial possibilities: {RRR, RRB, RBR, RBB, BRR, BRB, BBR, BBB}. All are equally likely. Let's take just the situations where Alice sees two red hats in front of her. The two ways this can happen are BRR and RRR, which (as stated before) are equally likely.
I like Tom Woolf's answer. It's (captcha) yummy.
Actually... by reading the comments here, I think I have discovered the true value of brain teasers for these interviews: So many people don't read the ****ing requirements before proposing a solution.
Admin
See, I always got into trouble in maths for not showing enough working. I wrote down every step that I took, but I just took fewer steps than everyone else  which taken to a pathological extreme, would result in marking me down for being more naturally able at maths because I didn't have to put in as much effort. (For myself, I couldn't understand why I would have to artificially bloat up my working by 200300% just to meet someone else's standards; and I still don't get arbitrary rules nearly two decades later.)
When I read what you wrote, it has the same whiff  the smell of incredulous mediocrity; the inability to properly recognise a level of ability you can't approach. I'm sure you'll get bright people who can follow arbitrary rules terribly well and are desperate to prove how good they are  but I'm equally sure you won't get anyone who is that good; even if they did apply, I'm fairly confident you'd turn them down.
Admin
Imagine how much Microsoft would benefit if, instead of asking riddles, they showed the candidate a piece of code with a buffer overflow vulnerability in it, and asked the candidate what was wrong with it.
Admin
I've seen some code written by that guy!
Admin
Yes, but those aren't the only possiblities for Alice. You are correct in saying that, should Alice see two Red hats or two Blue hats, she'll have a 50/50 chance of getting the right answer.
HOWEVER.
The case that she sees one Blue AND one Red hat is just as likly to happen, and in that case, the winning percentage of the group, as a whole, is a gurrenteed 100%. If she sees one Blue and one Red, and she's wearing Red, the Blue person will answer correctly. If she sees one of each and she's wearing Blue, the Red person will answer correctly.
Admin
Take all the possibilities and look at whether the strategy leads to a win or loss in each case. How many lead to a win? How many lead to a loss?
Admin
Yes, but in the UK we have people who steal road signs and traffic cones... or in one instance I was aware of, a set of portable traffic lights. It's a trophy, not an acquisition.
It's also why roads next to universities should never be worked on during term time...
Admin
Correct, you have a 75% chance of winning with that strategy.
For all of you "50%" freaks out there: notice that there are six correct answers (the middle six each have one correct answer) and six incorrect answers The first and last answers have three incorrect answers apiece. So, half the guesses are right, and half the guesses are wrong. The strategy just distributes those right and wrong guesses optimally so that you either completely fail, or do the minimum to win.
Brilliant if you ask me.
Admin
Admin
Admin
Admin
Admin
Incidently, the hats question is very similar to the Monty Hall problem.
You're on "Let's Make a Deal" (the TV game show). The host, Monty Hall, shows you 3 doors. Behind one of the doors is a brand new car. Behind the other 2 are goats. You choose a door, and you win whatever's behind the door you choose.
Now, obviously you want the car... unless you really have a thing for goats. I won't go there though.
Anyway, Monty Hall obviously knows which door the car is behind before the game starts. After you choose a door. Monty will open one of the doors you didn't choose, revealing a goat. (if you picked the door with the car, he chooses which door to reveal at random. If you chose a door with a goat, he'll show the other door with a goat behind it)
After he reveals an incorrect door, he asks you if you want to switch to the remaining unrevealed door, or stay with your origional choice.
Do you switch?
ANSWER: Yes. If you switch doors at that point, you have a 2/3 chance of winning the car. Discuss amounst yourselves why this is so.
Admin
Ok, I know someone made this point earlier, but let me try to underscore this again. Remember, no one guesses their color unless the other two hats are the same color. Then, they pick the opposite color. So...
It's true that Alice's chance of picking the correct color is 50/50. It's true that Bob's chance of picking the correct color is 50/50. It's true that Carol's chance of picking the correct color is 50/50. However, the strategy is such that the condition under which any one of them guesses the wrong color is the same as the condition under which the other two will guess the wrong color (specifically, BBB or RRR). In any of the other 6 cases, only one person will see the same color for the other two hats and will guess correctly (while the other two will see opposite colors and pass). In other words, while any individual still has a 50/50 chance of guessing correctly, all the incorrect guesses occur in the same 2 scenarios (BBB or RRR).
I hope this post has at least a 50% chance of clearing things up...
Admin
Admin
Admin
It's this mindset which will ensure that creationism ends up being taught in science classes, despite not being science, because "it's a valid alternative". It's antiintellectualism coated with a veneer of faux humility and a disingenuous claim to egalitarianism. And it really shouldn't be allowed to show its face in public.
So read and understand  when your solution is less optimal than solution X, you have shown that you are aware of X, and you have not demonstrated a flaw in X, you should be learning from X, not trying to present your solution as somehow "just as good really", or "worth airing anyway", and ESPECIALLY not a successor to X! Share your thoughts, sure  but quoting someone else's solution before presenting your own implies a criticism of that solution, so you'd damn well better actually make such a criticism.
Admin
Admin
All right. Consider a = 0.999999 (repeated) for ease of notation. In the case it's not equal to 1 (and I suppose you believe it's smaller) then 1  a is a strictly positive number.
Problem: Prove that b > 0 (you can't).
Also, see http://en.wikipedia.org/wiki/0.999
Admin
No, (.999...) = 1 (exactly 1)
You can convert a repeating decimal to a fraction by taking the repeating portion of a decimal as the numerator and [10^(numdigits)1] as the denominator:
.333... = 333/999 = 1/3 .444... = 444/999 = 4/9 .555... = 555/999 = 5/9 .666... = 666/999 = 2/3 .777... = 777/999 = 7/9 .888... = 888/999 = 8/9 .999... = 999/999 = 1
Admin
I finally understand why Microsoft products work the way they do! Their software is written by people who are specialists at providing overly complex solutions to nonexistent problems! Elementary!
Case in point: ribbons in Office 2007. Menus removed. Why? See above.
Admin
I'm not sure if such companies are truly not interested in hiring someone competent, or if they simply have no idea what competence is or how to assess it.
But either way, it tells you something useful about the quality of your potential colleagues. ;)
Admin
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?
Admin
This has been noted before, but you have convinced me too that asking riddles on job interviews is actually a good idea.
Admin
Or someone who values honesty and integrity above keeping up appearances and stroking egos.
...oh, I see where you're going with that one.
Admin
Admin
Admin
Admin
Oh, that'll be from the same corporate definition of "fun" that gives us Hawaiianshirt Fridays and "I Broke the Build" hats, I take it?
Admin
There are five pages of comments, which I'm not going to read.
But my strategy would be to have Phil look at his reflection in Bob's glasses and call out the color of his own hat.
Admin
Mount a mirror in the room during the initial strategy session. It's not prohibited, and looking at one's own reflection cannot possibly be construed as communication.