Joanna: So, where do you work, Peter?Okay, so it's not that dreary at my office, but I still like to give my brain something a little bit more stimulating than work once in a while. Like most programmers, I love exercising my mind on interesting coding problems and logic puzzles. It's much cheaper than taking the office printer out to a field (warning: explicit lyrics) once a week, and almost as much fun. Here's a list of my favorite programming and logic puzzle sites that help me keep my brain in shape.
Peter: Initech.
Joanna: In... yeah, what do you do there?
Peter: I sit in a cubicle and I update bank software for the 2000 switch.
Joanna: What's that?
Peter: Well see, they wrote all this bank software, and, uh, to save space, they used two digits for the date instead of four. So, like, 98 instead of 1998? Uh, so I go through these thousands of lines of code and, uh... it doesn't really matter. I uh, I don't like my job, and, uh, I don't think I'm gonna go anymore.*
Project Euler - Heavily mathematical programming challenges that can be solved in any language you choose. Many of the problems can be solved without programming at all, but most require a computer. Once you solve a problem you can view solutions that other users have posted. These alternative solutions are often helpful in cracking later problems with similar themes.
The Python Challenge - A series of programming challenges designed specifically to teach the Python programming language. Although any language could be used to solve the puzzles, many of the clues are easier to decipher if you're working in Python.
Ruby Quiz - A collection of challenging programming problems that can be done in any language, but if you want to submit them for evaluation, they should naturally be solved in Ruby. There's a companion book, Best of Ruby Quiz, that discusses possible solutions to selected problems.
Top Coder - Timed programming competitions in a variety of categories (algorithms, testing, design, assembly, and many others) with cash prizes from sponsors such as Microsoft and the NSA. Solutions can be submitted in Java, C++, C#, or VB. Take a look at the match archives to get a feel for what kinds of problems you can expect in competitions. There are also a lot of good tutorials written by moderate- to high-ranking competitors.
UVa Online Judge - Hundreds of problems from past programming contests such as the ACM International Programming Contest. You can submit solutions to the judge in C, C++, Java, or Pascal. Be sure to check out the companion book, Programming Challenges, as well as the new book From Baylor to Baylor, cataloging all the problems used during the 1991 to 2006 ACM-ICPC World Finals.
Sphere Online Judge - Hundreds more problems used in a variety of online programming contests. The best part of SPOJ is that you can submit solutions in dozens of different languages (see the list at the top of the problems page to see if your favorite language is included).
C Puzzles - Puzzles on this page explore common traps and pitfalls of the C programming language. Expert C programmers will probably make pretty short work of these problems, but they can be somewhat challenging if you don't know the idiosyncrasies of C.
Facebook Puzzles - A small set of programming problems used by Facebook to evaluate potential hires. You can submit solutions in C++, Erlang, Haskell, Java, OCaml, Perl, PHP, Python, or Ruby.
Google Code Jam - A timed programming tournament where contestants solve algorithmic problems in the language of their choice. I don't know if Google has any plans to hold another tournament in 2009, but you can still check out the problems from the 2008 Code Jam to see how you measure up.
Microsoft Interview Questions - First, let me say that I'm completely biased against the practice of using "brain teaser" questions at job interviews. Many of these questions depend more on a "flash of insight" than on logical thinking or real-world problem solving ability. If you use this style of question to screen potential employees, be warned that you're probably really only testing whether or not a candidate has read similar problems in the past. Having said all that, these questions are still a lot of fun to solve outside a job interview.
wu:riddles - An archive of hundreds of challenging logic puzzles with a wide range of difficulty. Problems are labeled if they require any special knowledge of math, physics, computer science, or chess.
What am I missing? If you don't see your favorite programming challenge or logic puzzle site listed above, please leave me a comment with a URL letting me know where to find it. I always love a new challenge!
Updates from the comments
Thanks to all the readers who left a comment directing me to new (to me) puzzle sites. Here are a few that I'm looking forward to visiting on a regular basis.
Programming Praxis looks like a promising new blog full of programming exercises to "sharpen your saw" on. It looks like new problems have been published on a regular schedule since February. I've already subscribed to the RSS feed.
Code Kata was a short series of problems published in 2007 by Dave Thomas of The Pragmatic Programmer fame. Code kata are "simple, artificial exercises which let us experiment and learn without the pressure of a production environment." Exactly what I'm looking for.
Any Prolog programmers will want to check out The First 10 Prolog Programming Contests (free PDF e-book) and Ninety-Nine Prolog Problems. (If Prolog isn't your thing, you can also do the 99 Problems in Haskell, Python, Scala, or Lisp.)
If you're interested in organized programming contests, you may want to check out the USA Computing Olympiad or the ACM Programming Problem Archives (many of the problems found here can also be found on the UVa Online Judge, mentioned earlier).
Al Zimmermann's Programming Contests (list of previous contests) present classic computer science problems for programmers to compete for cool prizes. It looks like the contests run from a few months up to a year, so there's plenty of time to enter the current contest.
Anarchy Golf has hundreds of problems and a server that allows you to submit solutions in 69 different languages. This submission reminded me that I had previously forgotten to mention Code Golf. For anyone who isn't familiar, code golf is a contest to see who can come up with the shortest correct solution to a problem. Java Enterprise Application programmers are allowed to play, but Python and Perl one-liners dominate in code golf.
Programming Puzzles & Code Golf is a Stack Exchange site originally started for gathering user-submitted Code Golf problems and the shortest solutions in various programming languages. The site's scope later expanded to include any programming puzzle, not just Code Golf style questions. Follow the code-challenge tag for general programming puzzle questions.
Lastly, as pointed out by a couple of readers, programming and logic aren't the only kinds of puzzles out there. Chess and Go problems can be a fun distraction as well. Chess.com has a daily puzzle that's moderately challenging for casual players, and GoGrinder is a terrific open-source program for practicing Go problems.
Thanks again to everyone who took the time to share their favorite puzzling Web sites. Hopefully everyone's productivity isn't impacted too much in the coming weeks. :)
* If you don't recognize that scene from Office Space, then run, do not walk, to the nearest video store** and pick up a copy immediately.
** LOL, "video store"! What am I, like 60? Get it from Netflix.
36 comments:
Goosey,
I've been playing Go for a few years now, and chess for most of my life. Excellent suggestion for keeping your mind sharp.
Some more puzzles, from the Logic Programming world: The First 10 Prolog Programming Contests. Written for Prolog programmers, but could be interesting in any type of language.
My blog Programming Praxis publishes a new exercise every Tuesday and Friday.
The site delphiforfun.org has many problems and puzzles for Delphi programmers.
http://codekata.pragprog.com
I also like adapting the Ninety-Nine Prolog Problems to other languages and solving them. Some of the later problems are reasonable challenges in any language.
Phil,
Those Prolog problems toward the end of the list do look interesting.
Thanks to everyone who has been leaving a reply. If this keeps up I'll be busy puzzling for quite some time. :)
http://train.usaco.org/usacogate
Includes lessons to teach algorithms to students.
Another one is CodeChef.
It has some practice puzzles, and every month there a competition which usually last for 14-days.
Solution may be entered in many different program languages...
The site has been re-organized quite a bit since I was there last, but the ACM programming problem archives was the source of a lot of really great programming puzzles I worked on solving when I was learning Python for fun.
A couple of my favourites are Anarchy Golf which supports 60+ languages and Al Zimmerman's Programming Contests.
The International Conference on Functional Programming runs a popular contest every year: the old contest archives are still available for people who want to try them out after-the-fact: ICFP contest page.
These are quite challenging problems, especially when you consider that they originally ran with a three-day (72-hour) time limit!
An old favorite of mine, has a lot of logical/math/science puzzles, graded by difficulty:
http://local.wasp.uwa.edu.au/~pbourke/fun/
I do a fortnightly puzzle on my web site for a geek meeting in Bangkok.
http://www.kirit.com/Categories:/BeerCamp%20puzzle
topcoder.com is a lot of fun. You can enjoy working the practice problems without getting caught up in the competition hoopla, if you prefer.
Google just announced that they will be doing another code jam this year. A bit later than last year though. August-Sept.
Bill-
have a look at the logic games @ playwithyourmind.com
There's also a book that may be interesting in the context: http://www.amazon.com/Programming-Challenges-Steven-S-Skiena/dp/0387001638
Am,
I have that book and I agree, it is really good. All of the problems are available on the UVa Online Judge, but the explanations of the chosen problems make it well worth the cost of the book.
Very nice collection, Bill! I tried to visualize it in a single mind map, and here is what I got.
Also I took some sources from Ben Dowling's post.
Hope you find it interesting :)
anvaka,
Very nice visualization. I'm bookmarking that site. I know it will come in handy. Thanks for sharing the link.
Visit for programming puzzles
http://coders-stop.blogspot.com
One of the best methods for learning chess is "fighting" with a chess computer. The wisdom of this has been proven I think. What do you think? I enjoy this site very much.
Thanks ken, I'm glad you enjoy the site. I think that chess computers are a great way for about 99.9% of people to get better at chess, so they provide great mental exercise. The other 0.1% are the grandmasters who are already better at chess than all of the commercially available chess programs. :)
add one more site for programming challenges
interviewstreet.com
I realize this post is a bit old, but what about CodeGolf.SE?
James,
Yeah, it looks like there are enough good problems on Code Golf to go ahead and add it. Thanks for the suggestion.
Hello all I just like to ask that what is the scope of c programming, what all topics should be covered and it is kinda bothering me … and has anyone studied from this course http://www.wiziq.com/course/2118-learn-how-to-program-in-c-language of c programming language online ?? or tell me any other guidance...
would really appreciate help… and Also i would like to thank for all the information you are providing on c programming.
Here's one I found (beside your post) while looking for some practice problems-
http://www.reddit.com/r/dailyprogrammer
Requiring some programming skills and certainly puzzling: http://stoptoilworndiamond.blogspot.com/
hacker.org
TopCoder is slow and horrible. The site itself is so badly designed that it should start a design competition to improve it
Topcoder is not good, but LeetCode and Javarevisited is good site to improve programming skill from interview point of view.
Great post! Enjoyed it :)
Thank you so much for this valuable blog. briansclub cm
Post a Comment