

Ask HN: What is your favourite technical interview question? - svag

I ask this question after reading this post http://news.ycombinator.com/item?id=1840774 [My Favorite Engineering Interview Question(skife.org)]<p>I didn't find any similar question in HN after a quick search in google, so please give your favourite interview question.
======
spokey
I "stole" this question from a friend, who may not have invented it either but
cultural/language barriers aside [1] I'll often ask something like:

* Larry Wall wrote "We will encourage you to develop the three great virtues of a programmer: laziness, impatience, and hubris." Pick one of these three "virtues" and tell me about a time you exhibited it.

[1] - Some less-than-perfectly-fluent English speakers are unfairly thrown by
this question, it has a lot of relatively obscure vocabulary, and then layers
irony on top. BTW, even among native English speakers the single most common
response is "what is hubris"?

Also, a standard although not necessarily favorite general interview question
I use (technical or not) is something like:

* Suppose we brought you on board at Firm X and found that you were doing an excellent job. What kinds of things could we do to reward you?

followed by:

* No job lasts forever. What sorts of things do you think would make you want to leave Firm X eventually?

~~~
svag
For the hubris definition, here <http://www.thefreedictionary.com/hubris> :)

Very interesting questions the last two, I am wondering what are the answers
that you get and how do you evaluate them.

~~~
spokey
For the record, I know what "hubris" means, it's the candidates that don't.
This may say something sad about the level of liberal arts education among
developers.

Now that I think about it, this also may say something about the candidates
ability to think on their feet and/or the degree to which their curiosity
exceeds their reluctance to appear ignorant, since the way the question is
structured it is fairly obvious you don't need know what hubris means to
answer the question. You can just pick another "virtue". I'm pretty sure
that's what I'd do in that scenario, but maybe I'm less candid than others in
interviews.

A couple of interesting things about that first question:

* My friend who introduced me to this question said he once had a candidate pick "impatience" and then proceeded to tell the story of how and why he threw a chair through a glass window during a meeting. That guy did not get the job. There probably would have been other red flags with that candidate, but it is interesting to note how few questions would likely lead to the candidate volunteering that anecdote. Throwing a chair through a window in a business setting is very bad. Not having the sense to keep that story to yourself during a job interview is the icing on the cake.

* I'm surprised how often candidates will miss or choose to ignore the "pick _one_ " aspect of the question and proceed to give one example for each. This doesn't necessarily strike me a positive or negative (actually, maybe a little positive), but it happens probably 60% of the time.

* For the some candidates this can be a good "employer branding" question in the sense that it suggests the hiring manager is at least a little bit clueful and appreciative of "hacker" culture. (And vice versa. Most answers to this question are acceptable, but language/culture issues aside I'm always a little troubled by candidates that don't understand how one could possibly consider those virtues. More to the point I don't see how a good developer could not recognize the importance of a little bit of laziness, impatience or hubris to their craft.)

Regrading the latter two questions:

Clearly the intent of the questions are to get a sense of what motivates the
potential employee (both positively and negatively).

I didn't know it when I first started using them, but it turns out these
questions are most valuable after the candidate has been hired, as they
provides significant insight into how to manage and motivate the employee.
It's nearly essential to understand how to motivate an employee, and this
turns out to be an easy way to get at that information. You could (and I have)
ask this question after the candidate is hired, but in my experience people
are candid about different things before and after being hired, sometimes it's
useful to plan for that.

I've come to realize that there isn't really a bad answer to this question.
(Well, maybe if the candidate couldn't come up with _any_ reward or cause for
leaving, but that's never happened.)

Answers I frequently hear for the first question include "give me more money",
"give me a promotion", "give me more time off" or "give me more
freedom/flexibility/autonomy". There's nothing really negative about any of
these answers, in fact I think each of them are pretty respectable, but more
importantly they say something about what the candidate values.

At some cash-strapped places I've worked the "more money" answer was a little
problematic, not for anything it says about the candidate as much as it
suggests they won't be happy in the environment that we could provide them. At
one firm I worked at "work/life balance" was non-existent, so "give me time
off" suggested a poor culture fit.

For most environments I've worked in a good answer to the first question is
something like "Once I've proven my competence I'd appreciate the opportunity
to take on new or broader responsibilities, or to work on more interesting,
more important or higher visibility projects." A good answer to the second
question is something like "If I wasn't learning anything new". (An very
valuable answer to the second question is something like "if my job became X"
or "if I no longer had the opportunity to do Y".)

Generally I'd prefer to work with people that are motivated by doing new and
interesting things well, people who are willing to take on new challenges. I
guess this answer also demonstrates a bit of ambition, which is a good thing
in moderation. It also may show a degree of political savvy, in the sense that
"pay me more", while honest, is probably not something most potential
employers want to hear (at least for many job categories; on Wall Street or
for a sales job I guess that might be just the answer you're looking for, but
those folks are usually compensated on a commission basis to begin with).

------
DirtyAndy
For windows based web development: How would you create a web page that said
"Hello World"?

It the answer is not _start notepad (I'll accept Notepad+), type in Hello
World and save it as .htm or .html and put it on a webserver_ then for most of
the places I have done interviewing for over the years they have missed the
first requirement, get it done as easily and quickly as you can.

I fully appreciate that this varies massively by company, and I would want to
know that the person can answer certain levels of technical questions but
finding people who don't overcomplicate problems is hard, finding people who
learnt recursion at university or as another commentator mentioned, can define
polymorphism is actually not that hard.

~~~
thetylerhayes
Interesting. Even though I fully subscribe to the minimalist notion, I would
have opened notepad and at least entered valid HTML:

    
    
      <!DOCTYPE html>
      <title>Hello page</title>
      <p>Hello world</p>
    

Thanks for sharing that viewpoint. I never thought of it that way. (Perhaps
freelancing has made me forget good habits.)

------
zem
programming: "how would you take a word list and partition it into sets of
anagrams?". touches on some very basic data structures and algorithms, shows
that the candidate is at least familiar with arrays and hashes and knows when
to use which. it's amazing how many people don't get it, even when given an
hour to do it on an actual computer.

design (with the aid of a whiteboard): how would you go about writing a call-
graph explorer? start with the high level pieces and go into more detail as
asked.

algorithms: "there are data structures that make tradeoffs between various
operations (give examples). can you design one that has O(1) insert and O(1)
extract-minimum, with everything else running in as much time as you like?"

if you're asking about my favourite question i've been asked, it was "given a
set of numbers from 0 to 2^n-1, with one missing, how would you find the
missing number in one pass through the set and using at most n bits of extra
storage" (took me embarrassingly many tries to get it, but it was a satisfying
question to solve)

------
rdmlx
A technical question, or a question in a tech job interview?

Non-technical: What are you passionate about? (This can tell you a lot about
someone.)

Technical: How would you solve problem x? (Where x is an actual problem we
have had to solve working on our application. Relevancy is important and cuts
through the 99 common interview questions fluff).

------
frankc
My favorite programming question to ask is: Write a function that given an
integer n returns the number 1 to n in random order

I find this is a good mix of not too trivial but not overwhelming, I don't
expect people to come up with the fastest possible algorithm on the spot. If
they code the naive solution, that's OK if it makes sense and they can
describe the performance characteristics. Then we'll talk over the algorithm
and I lead them to something better and see how the conversation develops.

------
qollin
If I interview Java programmers I always start with letting them write a
method to reverse a String on the whiteboard. ~30% fail, for the others it's
an easy warmup. I then ask how much memory this method consumes and if they
could think of a better way to do it if this were C and not Java. This leads
to the concept of immutability of Strings and you now can have a discussion on
why the Java folks chose to make String immutable in the first place...

------
demiart
Well... the answer to that question really depends upon what set of
technologies the applicant is approaching the position with. One question,
however, that seems to always tell a lot about the person being interviewed
is: "You are asked to mentor a new developer, fresh out of school. What
habits/best-practices, language-specific and general, have you learned through
your years of working that you feel should be offered to the new hire?"

------
djb_hackernews
Not my favorite, but interesting:

You are given two eggs and a hundred story building. You need to tell me,
using as few drops as possible, what the highest floor you can drop an egg
from and it won't break.

~~~
spokey
Is the answer you're looking for a binary search algorithm, or do you have
some lateral thinking solution in mind?

~~~
MountainDrew
Because you only have 2 eggs I don't think you can use a binary search
algorithm (assuming I understood the question correctly). I think you'd have
to start at floor 2, if that passed then jump to floor 4, etc. until you have
an egg break (lets call this floor n). Then, you go to the floor below the one
that broke the egg to see if an egg survives that drop. You'll then know,
using only 2 eggs the highest floor you could drop from without breaking an
egg (either n, n-1, or n-2).

~~~
spokey
Spot on. I missed the _2_ part, which makes this question much more
interesting. By the way, I think I do could it in one drop; drop one from
floor 1. If it breaks the answer is 0, else 1 because I don't think many eggs
could survive a two story drop.

------
burnman
I understand they are trying to get an idea that i have a very basic knowledge
of programming, but, this has been a pretty good gauge on the quality of a
company.

"Define polymorphism."

~~~
korch
Maybe it's just me, and maybe I'm wrong or over-thinking it, but this question
bugs me. I think this is a trick question, because there is no single right
answer unless the question is prefaced with "in [language X], define
polymorphism." I've lost track of the number of times I've been interviewed
and had that awful question tossed at me.

Without fail, every single interviewer in my experience was looking for an
answer strictly in terms of whatever language(s) they're using at the company,
or whatever language the interviewer is most familiar with. If you stray
outside of what they know and what they're looking for, they have no idea what
you're talking about.

Polymorphism in Java is slightly different than for Ruby than for C than for
Haskell than for yadda, yadda. No matter what, it's always going to be
somewhat arbitrary and tied to some kind of language dependent implementation
or feature. If your language doesn't even have classes, the answer is
different, if your language doesn't have functions, it's different, etc, etc.

I suppose the closest thing to a right answer would be to define it in pure
mathematical terms using Turing machine notation, so as to make it universal.
However I have no idea if such an answer even exists. If anyone has seen such
a thing, please do share it.

A better version I would ask would be: define polymorphism using x86 AT&T
assembly. or: define what polymorphism _represents_

------
svag
<http://news.ycombinator.com/item?id=1840774>

------
phalien
What browser would you take with you on an isolated island?

~~~
Robin_Message
One that doesn't auto-upgrade itself (in case they send a broken upgrade, then
I'll have no browser.)

------
MountainDrew
When can you start?

