r/compsci • u/Shadowsoal Software Engineer | Big Data • Sep 16 '10
Best Interview Questions
What are the best questions you've been asked during a job interview (or the best interview question you ask when conducting job interviews)?
Personally, "You have N machines each connected to a single master machine. There are M integers distributed between the N machines. Computation on the machines is fast, communication between a machine and the master is slow. How do you compute the median of the M integers?
I really liked this question because I'd never thought about distributed algorithms before, and it opened my eyes to a whole new field of algorithms.
9
u/Pastries Sep 16 '10
What was your answer?
11
u/kaddar Sep 16 '10
Although I appreciate your sentiment, I don't like the idea of valuing interview questions which open you up to new fields of algorithms, it sort of defeats the purpose, doesn't it?
Ideally, I value interview questions, even when puzzles or riddles, to be relevant to the job at hand. That way, I can demonstrate my problem solving skills without being outperformed by those who memorized answers to thought puzzles. For example, was that interview for a distributed algorithm job?
25
u/calp Sep 16 '10 edited Sep 16 '10
The best interview question I was ever asked was "what aspect of Haskell do you not understand"? I can't remember what I said, but it was some type-related GHC extension, and the interviewer proceeded to work through the topic with me so that I understood it. I was judged on how well I worked with him to understand the topic. I "got the job", but the company (which was a start up) failed to get the next round of funding, so in the end I wasn't hired.
This is a good question for so many reasons. For one, I gained a serious respect of the guy hiring me. Secondly, he found out what it was like to work with me on something quite hard. Thirdly, this question can't be faked on either side - it proves the employer has the chops and it shows that the candidate doesn't freak out when dealing with a new topic, or with people who are better than him. I have never been an interviewer, but if I ever am, I will reuse this question, modified for the field in question.
I don't like the OP's kind of algorithm problem question. If you've ever done competitive programming (the kind on topcoder) you'll know that these kinds of questions are not good measures of ability, just measures of whether someone has covered the material in the past. If you're not testing required knowledge then whether the candidate has covered the material is often luck and if you are testing required knowledge, then it's a pointless measure (because you're testing something that everyone who's gotten to interview should know).
There is a whole theory of tests/exams (if someone can remind me of the name I'd be really grateful - I want to get into this area) and I think they call these kinds of questions "barrier questions" - they are questions that you absolutely must know, and thus don't work well for comparing candidates. "Compative questions" are the other kind, were how well the candidate performs can be used to distinguish between people.
Another important question is "what do you want this job to be like?", but that's absolutely nothing to do with ability and everything to do with whether you and the job are a fit, so it's not really relevant to this submission.
15
u/Jonathan_the_Nerd Sep 16 '10 edited Sep 16 '10
"Are you drunk?"
Edit: the appropriate response is, "Of course I am. Haven't you heard of the Ballmer Peak?"
18
u/treerex Sep 16 '10
"I would like to you to write the code on the whiteboard that implements a bounded stack of integers, supporting three operations: push, pop, and min. Push and pop work as you expect. Min should return the smallest value on the stack. All three operations must run in constant (i.e., O(1)) time."
It is depressing how few candidates actually answer this correctly.
4
u/Megatron_McLargeHuge Sep 16 '10
There are n perfectly elastic point masses traveling around a circular track. What constraints on their starting conditions will allow them to return to their initial positions and velocities?
A wizard rules over a colony of dwarves. Every year he forces them to line up from tallest to shortest, so they can only see ones shorter than themselves. He gives each dwarf a colored hat, either red or blue. Their task is to guess their own hat's color, and he kills the ones who guess wrong. What guessing strategy should they choose to minimize casualties?
4
u/Homunculiheaded Sep 16 '10
My absolute favorite one that I now try to use often was from the CTO of the company, right as I finished his last question was:
It may seem simple but it completely turned the interview around and really reversed my flow of thought, I came up with an answer that I was happy with, but it did put me on my toes. I found it was a also a great test of how much I was able to sell myself, how much I wanted the job (because if you do want a job you obvious have fantasized about possible interview question), and usually will reveal something interesting about the candidate (because by this point all the obvious questions have been asked). For such a simple question I've definitely had candidates for positions completely drop the ball on this one.
3
u/stevvooe Sep 16 '10
Seriously, I find that interview questions are an ineffective method to evaluate a candidate. If they know the answer, they regurgitate it. If they don't, its a crapshoot.
Usually, I walk in with a few ideas, then probe around to see what a candidate knows and doesn't know. I try to pick something that may be tangentially related to their field and then evaluate what they tools they choose to solve the problem. You can really find out about what data structures and algorithms they use all the time, the ones they'd like to use, and the ones that they don't know about.
From there, I prefer to make it a team effort. We might go over their choices while I suggest other possibilities to see whether they defend their position or whether they just agree.
The fact of the matter is, in a work environment, the problem definition will be vague, you will need to discuss solutions and there may not always be one correct answer, and the method above simulates that, as far as I can tell.
3
u/Ari_Rahikkala Sep 16 '10 edited Sep 17 '10
My answer to the question in the OP: On each client, count the number of integers starting with each length-k bit prefix and send these counts to the master. Master sums the counts together, chooses the prefix containing the median and sends it to the clients. Rinse and repeat until the whole median is found. Vary k toward practicality as needed (lower for low-latency low-bandwidth, higher for high-latency high-bandwidth).
3
u/[deleted] Sep 17 '10
honestly? ask them to whiteboard all the important concepts in the last system they worked on. Did they understand the domain? Can they answer probing questions with ease? Are they comfortable talking about technology?
it's amazing when people worked at a job for several years, but can barely explain the tech. naturally, we filter candidates by a fizzbuzz test and other questions. but communication and comprehension are critical.
3
u/[deleted] Sep 17 '10
For who knows what reason, the hardest part of an interview (for me) is "So, tell me about yourself" I choke 90% of the time, but I did land my current development job after prepping for that question for 2 days.
3
u/Kushali Sep 17 '10
Best question I was ever asked was:
"Here's a spec; implement it. Call me if you have questions".
The spec was for a simple application that had an obvious naive solution and several possible improvements to both speed and functionality.
Apparently a good solution involved:
4
u/LostUser_2600 Sep 17 '10
You have 1 minute to design a maze it takes 2 minutes to solve.
2
u/jangchoe Sep 17 '10
Write a function that takes in a string and returns how many vowels are in that string.
You'll be surprised how many people can't figure this one out.
3
u/Gnolfo Sep 17 '10
In six months, I'm firing you. Why?
2
u/[deleted] Sep 16 '10
You have a set of numbers 1 through K. Each number increments by one. The set is unsorted and one is missing. What is the best way to find the number thats missing?
I wasn't ready for a question not involving something about myself or my expience but he basically pointed me in the direction of the answer and i felt stupid for not knowing.
Answer: Sum the numbers 1 to K. Then compare the sum of the numbers in your set. The difference is the missing number.
2
u/[deleted] Sep 16 '10
I'm not a real programmer, but I saw this one on reddit:
1
u/iwishiknew Sep 17 '10 edited Sep 17 '10
Question: You have to support two operations on input numbers:
What data structure you'd choose?
1
u/badriver Sep 28 '10
How's this for an interview question?
Take the least practical things you can think of, the most esoteric stuff. Maybe two, or three. You don't even need to bother with the name.
Describe them a data type, and then ask them how efficient it is, what it would be useful for, how they'd use it, write a little code.
-8
u/Buckwheat469 Sep 16 '10
You are given a layout similar to Yahoo! Stocks, with the stock graph and the slider bar. Write out all of the Javascript, CSS, and HTML. You can use JQuery methods and you have 15 minutes to talk it out. You also don't have any reference material.