views:

1159

answers:

9

According to Manoj's answer to my question here, what do you suggest as a good problem that should stretch the interviewee's (horrible word ;-) programming capabilities and show whether he is a good programmer?

+2  A: 

I've just read the Blog Post by Steve Yegge that is linked from this answer in your original Question. There are some coding examples.

boutta
A: 

One traditional thing is to ask them to implement some basic data structure (like linked list).

Touko
+2  A: 

I had to write "Just" a program. I had 1 week, and a language I never used before(WinDev). I blew them away, all I did was a little game of lights-out. But I had to work around different kinds of limitations in the trial version of the software I used. I was the only one that managed to learn a new language and wrote a game in one week.

Sorskoot
+10  A: 

I would ask the candidate to work with me in a pair programming in some real project.

Ricardo Acras
+1  A: 

I can remember a theoretical algorithm problem from a university exam:

You are provided a text file and your task is to print its content (lines) in reversed order. The file is quite long but you are allowed to use only basic file actions (read a line), a limited number of variables (ie., not one for each line), and an action that prints a variable to the screen.

So, what do you think? (I'll post the solution in the comments.)

gius
Solution: 1.Create the function 2.Read next line from the file into a variable 3.Call the function (recursion) 4.Print the variable
gius
Using non-tail recursion to overcome memory limitations is like using a semitrailer to knock down a gate with a sign "no cars allowed to pass"
Aur Saraf
It was not a real-life problem. It was more an algorithm problem.
gius
+1 to semitrailer. Creating a new function call for each line semi-implicitly creates a new variable binding. If anything, it is even worse on memory than just creating a variable for each line.
Svante
I might add, by the same reasoning you could call an array "just one variable".
Svante
and you'll blow up the stack on a large file
KevinDTimm
A: 

From Joel's Guerrilla Guide to Interviewing:

For programming questions, I ask candidates to write a small function in C. Here are some typical problems I would ask:

  1. Reverse a string in place
  2. Reverse a linked list
  3. Count all the bits that are on in a byte
  4. Binary search
  5. Find the longest run in a string
  6. atoi
  7. itoa (great, because they have to use a stack or strrev)
Galwegian
I always ask #3, but I work on projects controlling machines usually.
kenny
Iv've asked 1 (array, not string) recently, and a guy with 10 years of experience had problems with it!
quant_dev
I've got 25 years of C/C++/Java/Python/VB/Perl/shell and can see #1 and #2 being a pain in the ass, just because most frameworks have this ability already so I've expunged the memory locations where these algo's were stored :)
KevinDTimm
+2  A: 

For database programmers, i always give the task of de-duplicating a list (i.e. a table that hasn't got a primary key) and a table that has a primary key. I then ask them to write a select statement that lists the rows that are only in one or other table but not both. I might also ask them to do a pivot rotation or aggregation. Strangely, it is this sort of very simple task that seems to sort out the people who have the skills. It comes through as clear as a bell the moment they get stuck into the task.

Phil Factor
A: 

I would have them prove the Monty Hall problem.

Kevin Laity
A: 

I was recently asked to manually parse a string as an integer, without using any built-in casting or converting.

George Jempty