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?
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.
One traditional thing is to ask them to implement some basic data structure (like linked list).
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.
I would ask the candidate to work with me in a pair programming in some real project.
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.)
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:
- Reverse a string in place
- Reverse a linked list
- Count all the bits that are on in a byte
- Binary search
- Find the longest run in a string
- atoi
- itoa (great, because they have to use a stack or strrev)
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.
I was recently asked to manually parse a string as an integer, without using any built-in casting or converting.