A coding exercise for interviewing candidates. Currently in C#, but feel free to port it to other languages.
It tests understanding of the following things:
- Interface oriented design
- Basic programming constructs like loops, if statements, etc.
It is usually applied by having the person interviewing solve the problem first and if they do solve it, you can have a very good discussion on how to optimize the code to call the CountBlocksSet method less on average.
Original can be found over at Jomo Fisher's blog.