views:

133

answers:

5

Possible Duplicate:
Algorithm/Data Structure Design Interview Questions

Share some of good problem solving and data structure questions for hiring a fresh programmer.

+1  A: 

My favorite is known as "FizzBuzz":

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

Branimir
And it is frightening how many software developers with 10+ years experience are unable to solve it...
nikie
A: 

How would you print out the data in a binary tree, level by level, starting at the top?

Faisal
A: 

For a much more involved exercise, and for candidates already familiar with one or more higher-level language (such as C++ vector or Python list), try implement Sieve of Eratosthenes.

rwong
This kind of question is really bad for an interview. It's super easy if you happen to know the algorithm, and about impossible otherwise...
Cam
I'm assuming that the interviewer will provide the full explanation (including the full wikipedia article, in print), and give sufficient time to the candidate to read it and ask question. Nowadays the problem with technical interview is that employers want to make decision with too little time.
rwong
A: 

I ask if the candidate can explain how a list works internally (for example java.util.ArrayList) and how a hash table works internally (for example java.util.HashMap). If they don't know, at least they should know the performance characteristics, and what a hash code is.

Thomas Mueller
A: 

Provide a solution to the following problem: Given task T and integer NumSeconds, Call T in NumSeconds.

Hint: The candidate will need to implement a data structure that will allow adding tasks and a write a procedure that queries the data structure and calls the matching task(s)

Tor