When I was in university, I helped organize a programming competition for Computer Science students. I believe we had 4 questions in total and allowed an hour for each one.
The best received question was:
- Sort a series of integers such that the order goes from lowest-highest-lowest. eg. If given 1,2,3,4,5,6,7,8,9,10, the correct sort should result in 1,3,5,7,9,10,8,6,4,2. The winner will be the team that has the smallest source code.
The winning team for this one used Perl and their code was just a long, ugly string of one-line code with no spaces.
Another question I remember was:
- Without using 3rd party libraries, implement a compression algorithm. The winner will be the team that is able to compress and decompress without any data loss and whose compressed file is the smallest size.
Unfortunately this turned out to be a poor question. No team even was able to get it working even after giving them extra time. I think everyone was thinking too big and trying to do things that could not be done in an hour.
What are some fun and simple programming competition-type questions that you have seen?