News for hackers. Stuff that matters.
Re:Thank goodness we hired someone who can reverse a b tree ... by gumby on Wednesday April 17, 2019 @09:42PM (#19688054)
I partially disagree.

I completely agree that "trick" questions only select for people comfortable with trick questions. It doesn't hurt if someone who is good at them that is on the team but let it happen organically -- and let it be a non-jerk, which is more important!

I completely agree that coding problems can be excuses for jerks to nitpick, and about the only "good" thing that could come out of such a situation is that the candidate learns that the company employs jerks and doesn't mind them talking to candidates.

However:

The whiteboard can be a welcoming tool if used right. How do you think, how do you talk about the problem, do you actually know the basics?

We use Java, C++, Python and Javascript. We do want you to know one of them. We don't care, in the interview if you forget or misname the name of a routine, or get the arguments backwards (you're not in front of a computer; you don't have to worry about your typing speed, looking up the name, unfamiliar settings on the machine you're in front of, house style etc). We don't care if you forgot a semicolon or even a closing brace, much less a #include. Use whichever language you're most comfortable from the set you'd be using in your job. The best "problems" should be less than a dozen lines, even without any fancy tricks.

We pick something boring, say from the standard library, and nothing tricky like a hash table. Really boring like floor(). If you can't figure out how floor() does its "magic" that's scary. If you need to look up how to balance a tree in place, that would be no big deal so don't put someone on the spot. If you claim to know python but can't print your outputm, that's bad. If you claim to know python and your indentation isn't clear on the whiteboard who cares?

I've told this story on HN before: almost 20 years ago I interviewed a candidate who wrote a routine to shuffle a deck of cards on the whiteboard (we use even simpler examples today). His program ended up elaborately coping the input to the output without shuffling. One of us asked, "Is that really a shuffle?" He said, "Oh I'm a fucking idiot" and fixed it. He was an awesome hire.

At one company we had a standard question (again, write XXX from the standard library) that had a special outlying case. Only one candidate got that, but we hired several people who missed it. Stuff like that can be caught in code review.

But I've interviewed several candidate who spoke well and claimed to know, say, C, but couldn't write "hello, world" in that language. Whiteboard caught it.

Re:Thank goodness we hired someone who can reverse a b tree ... by microtherion on Wednesday April 17, 2019 @10:38PM (#19688299)
> We pick something boring, say from the standard library, and nothing tricky like a hash table. Really boring like floor(). If you can't figure out how floor() does its "magic" that's scary.

What I find scary is that you think floor() is an easy algorithm. Here's a typical high quality implementation of floor() (Plauger's implementation in "The Standard C Library" is different, but of similar complexity). Not something you'd derive on a whiteboard: http://www.netlib.org/fdlibm/s_floor.c

I'm concerned that a question like this is selecting for mediocre programmers who'd brute force some solution, while causing programmers who are aware of the complexity of the problem to freeze.

Re:Thank goodness we hired someone who can reverse a b tree ... by jdhopeunique on Wednesday April 17, 2019 @10:59PM (#19688383)
Interviewers underestimate the complexity and problems floating point numbers cause in interview questions.
Re:Thank goodness we hired someone who can reverse a b tree ... by craftinator on Wednesday April 17, 2019 @11:52PM (#19688578)
I've recently had an interview where the interviewer scraped my most recent project off of GitHub, then asked me to add a feature, using a whiteboard. In my opinion this is the RIGHT WAY to do it. The codebase is obviously familiar to the candidate, along with the problem domain. This rules out memorization, puzzle gaming, etc... It informs on programming style, ability to somewhat think on ones feet, but doesn't exclude candidates who didn't happen to guess what the interviewer wanted before the interview began.
Re:Thank goodness we hired someone who can reverse a b tree ... by kstenerud on Thursday April 18, 2019 @02:42AM (#19689195)
No, that's the completely wrong way to do it. Download the code onto a computer. Ask the candidate to add a feature.

Or, do a screen share.

The moment I'm asked to write code on a whiteboard, I politely ask to use a computer. If they can't accommodate (I bring my own laptop just in case), the interview ends.

Re:Thank goodness we hired someone who can reverse a b tree ... by craftinator on Thursday April 18, 2019 @09:37PM (#19696353)
Yeah I agree that in a perfect world, people whose jobs will entirely consist of working on a computer, mostly in an IDE, should not be interviewed on a whiteboard. But the whiteboard is a filter for people who are so unfamiliar with programming that they can't reason without the crutch of an IDE. For example, I've seen some people who can do amazing things with Scratch IDE, but can't sit down in front of nano or vim and hammer out code to save their lives. IDE's can be a crutch for thorough learning of a language, and I learned that by leaning too hard on JetBrains, then trying to dev over ssh on a raspi.
Re:Thank goodness we hired someone who can reverse a b tree ... by james_s_tayler on Thursday April 18, 2019 @04:15AM (#19689548)
how many times have you ended an interview that way?
Re:Thank goodness we hired someone who can reverse a b tree ... by gumby on Thursday April 18, 2019 @01:25AM (#19688930)
That’s a good idea
Re:Thank goodness we hired someone who can reverse a b tree ... by scarface74 on Wednesday April 17, 2019 @10:09PM (#19688182)
In the real world, we aren’t writing code on the board. We may be drawing architecture. So why not sit them down to a computer and tell them to solve something approaching a real world problem?

We even have these things called “unit tests” that you can have already written and you can let them write code that make the unit tests pass as a pair programming problem.

Re:Thank goodness we hired someone who can reverse a b tree ... by gumby on Wednesday April 17, 2019 @10:18PM (#19688212)
That's a good question, as it seems I was not clear.

The execution risk and performance anxiety of being at the machine is, IMHO, higher. Your machine may have an ergo kbd; you may be used to using an editor that's not installed, or want to call a library that hasn't been installed, or... You can make various typos (include files, whatnot) and be embarrassed.

OTOH with a whiteboard, a friendly couple of interviewers are going to ignore if you wrote #include <iostreams> (which I type all the time) and look what you wrote. The compiler will not. etc.

I find it weird that companies try to make their interviews hazing rituals (which include but are not limited to the WTF of unfriendly interviewers). We want to hire someone to help us get to our goal. If the person is in for an interview they've already been through a phone screen, and the cost to the company of interviewing is high. Yes, a bad hire is a problem, but as the original tweet says: tricks that make things difficult do nothing to help you find a great person to work with. so try really hard to damp out the distracting transients -- make the process a low pass filter.

Re:Thank goodness we hired someone who can reverse a b tree ... by scarface74 on Wednesday April 17, 2019 @10:39PM (#19688301)
That also tells you something.

For instance, the first time I had a pair programming type of interview like I described, they in fact did have an ergonomic split keyboard for me to use. For physical reasons, I type with one hand and couldn’t possibly type efficienctly on one. I had no problem asking them for a normal keyboard. If they had seem to have a problem, that would have told me a lot about the company.

You could even ask what their favorite editor is before hand even as part of the phone screen.

Re:Thank goodness we hired someone who can reverse a b tree ... by mr_toad on Thursday April 18, 2019 @02:03AM (#19689058)
I’ve never heard a coherent explanation of what ‘inverting’ a binary tree even means.

And B-trees are much trickier to get right than binary trees. Anyone who can whiteboard a b-tree from memory without errors is some kind of savant.

I think this whole reverse a b-tree story is apocryphal.

Re:Thank goodness we hired someone who can reverse a b tree ... by gumby on Thursday April 18, 2019 @04:01AM (#19689496)
I agree with it seems apocryphal. I can only imagine interpretations of the statement "invert a tree" that are so trivial as to test nothing (as in "invert the multiplication of A * B" uhh, "B * A"?).

I suppose if I were asked I'd ask for clarification of what was wanted, and either they want someone who asks such questions or both of us leave the room relieved that we won't be working together.