views:

444

answers:

8

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?

A: 

There's hundreds of interesting problems at Google Code Jam and Top Coder.

Andreas Brinck
A: 

Try to search "Code Golf" in StackOverflow itself.

Konamiman
+1  A: 

I quite enjoyed this one. You might need to slightly simplify it to make it achievable in an hour.

Dominic Rodger
If the integers from 1 to 999,999,999 are written as words, sorted alphabetically, and concatenated, what is the 51 billionth letter?
Ciwee
Yep, that sounds like a nice simplification - also makes the question a good deal less confusing!
Dominic Rodger
@Dominic Rodger: I didn't simplified the question, I just copied the first paragraph so that users have an ideia of the question without visiting the link :)
Ciwee
@André - if you read the full question, you'll find out you did simplify it! :-)
Dominic Rodger
+7  A: 

http://projecteuler.net/

Here is an excerpt from the page:

What is Project Euler?

Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems.

The motivation for starting Project Euler, and its continuation, is to provide a platform for the inquiring mind to delve into unfamiliar areas and learn new concepts in a fun and recreational context.

Euler is a good example, but sometimes to become very hard and complicated not fun. BUT, till that time you will be already addicted :)
medopal
yeah, it's programming + math
middus
A: 

If they are Computer Science students, it might be more interesting to try to come up with a good algorithm (i.e. working efficient on all allowed input) instead of a short algorithm.

There are tons of programming contests which have problem definitions (and solutions) available, such as the Benelux Algorithm Programming Contest.

catchmeifyoutry
A: 

There's a huge number of good problems available at UVA's website (the solutions can be verified online): http://uva.onlinejudge.org/index.php?option=com%5Fonlinejudge&Itemid=8&category=3

Ciwee
A: 

In my first year of univeristy we had a competition to create a program to process basic image files (PGM if I recall correctly).

We had to submit code that operated according to specification and run a variety of simple transformation operations. Entries were judged according to execution time and code size. They were manually inspected for code style and images output were checked to ensure the operations were run correctly.

It was lots of fun with the winner recieving O'Reilly books and runners up getting O'Reilly t-shirts.

Tom Duckering
+1  A: 

Try this site: Python Challenge

A lot of funny tasks that can easily be converted to other programming languages.

bastianneu
wow this is amazing, but i quickly got stuck, seems you should be a Python geek. Anyone know about a Java equivalent?
medopal
http://www.javablackbelt.com is good for upgrading your skills regarding java..it is not a programming challenge..but the questions get harder and harder..you get a good feeling for your strengths and weaknesses
bastianneu