News for hackers. Stuff that matters.
Re:Why we don't hire programmers based on puzzles and tricks by danielweber on Friday February 22, 2013 @11:17AM (#5264994)
As much as people say "well, everyone knows about Fizzbuzz by now," lots of people still can't do it.

"Swapping two variables without a temp" is a bad question, because it depends on knowing the trick.

"Find the 2nd-highest element of this list" is a basic question, and I can change it up it a zillion ways such that anyone trying to just learn all possible permutations will end up doing way more work than someone who can just figure it out on the fly.

Re:Why we don't hire programmers based on puzzles and tricks by ricardoz17 on Friday February 22, 2013 @12:03PM (#5265235)
I think the swapping two variables has a bit more going for it if they do not know the trick. Explain the concept of invertible functions. Hopefully they would be able to come up with plus and minus - even if you have to walk them through the a=f(a,b) b=g(a,b) a=g(a,b)

From there you can say that works fine with pen and paper but why might it go wrong in a program? So how do you avoid integer overflow? If the signs are the same then use subtract first else use addition first. After we have done that. After this step assume I have returned to the main flow. How do I check if I should use addition or subtraction? If a is bigger than b I must have added so use subtraction. Writing the algorithm this way is trickier than xor. The problems to be solved are to do with understanding concepts

Next you have the xor solution but more important than getting the answer to that might be to see if they can see that the two functions are like encrypt and decrypt where a is the message and b is a key and a + b is the ciphertext c - so that f(m,k) is encrypt and g(c,k) gives the message and g(c,m) gives the key. If they have had any exposure to cryptography then xor should present itself.

If they give xor straight off then you can work backwards.

Re:Why we don't hire programmers based on puzzles and tricks by pbiggar on Friday February 22, 2013 @12:40PM (#5265439)
You're missing the point, and this is how people end up at these "puzzlers". The point of fizzbuzz or the simple questions is to weed out people who can't code at all. If you transform it like you do above, then you're testing something else: how well people know low-level tricks like swapping variables using xor.

Those tricks might be valuable in your workplace, and may make excellent interview questions for you, but they are a very very different type of question than fizzbuzz, at least in purpose, even though they may look superficially similar. In a fizzbuzz type question, you are not looking for brilliance, you are looking to just weed out the people who can't.

Re:Why we don't hire programmers based on puzzles and tricks by doktrin on Friday February 22, 2013 @02:49PM (#5266308)
Exactly. This is precisely the problem. It's not that any particular question is a "bad" choice, per se, it's that interviewers can fail to realize what they are actually testing for.
Re:Why we don't hire programmers based on puzzles and tricks by michaelt on Friday February 22, 2013 @06:10PM (#5267541)
XOR trick? I'm not sure I'd want to work for someone who didn't know about the x86 xchg opcode.
Re:Why we don't hire programmers based on puzzles and tricks by nazgulnarsil on Friday February 22, 2013 @05:29PM (#5267323)
I had never seen the XOR algorithm and after seeing the parent post grabbed a pencil and paper and tried to come up with something. Took a couple minutes and I consider myself a middling programmer.