top | item 4401276

Collection Of Puzzles For Programmers

118 points| ycombwin | 13 years ago |blogs.lessthandot.com | reply

32 comments

order
[+] rauljara|13 years ago|reply
Obligatory Project Euler plug whenever anyone posts a collection of puzzles for programmers. http://projecteuler.net

These sorts of puzzles are great for when learning a new language. Take a bunch of problems you've already solved in one language, and see how the solution works in another. If the solutions are too similar, it may be a sign that you aren't quite grokking yet how to think in the new language. Or that the new language is very similar to the old one. In which case, perhaps it would be more worth your time to learn a more different language. As Perlis said, "A language that doesn't affect the way you think about programming, is not worth knowing."

[+] RegEx|13 years ago|reply
> "A language that doesn't affect the way you think about programming, is not worth knowing"

Makes a good quote, but I don't buy it from a practical perspective. Library support is my primary motivation in choosing which scripting language to use for work projects. I don't think much differently at all in Ruby than in Python, but knowing both is extremely helpful.

[+] Peteris|13 years ago|reply
As you point out, Project Euler and other simple puzzles are good for picking up new languages. Of course, Euler actually has a broad set of tough problems, but many people prefer solving the first tenner using one-liners.

It's slightly vintage now, but there is nothing better for getting actual algorithmic problem solving ability per time invested than USACO at http://train.usaco.org/usacogate. It was developed by the US high school competitive programming coaches. If you can plow your way through the first couple of sections, even the toughest interview questions will seem easy.

Serious.

[+] energiehund|13 years ago|reply
I recommend the 250 points and 500 points problems of topcoder(http://www.topcoder.com/). Some of the classical puzzles are so straightforward, while more effort is needed to find the tricks of the problems on topcoder.
[+] Emouri|13 years ago|reply
I seem to recall there being a subreddit filled with these kind of puzzles, but I can't find it right now. Anybody know the one I'm talking about?

edit: this was the one I was thinking about http://www.reddit.com/r/dailyprogrammer

[+] the_cat_kittles|13 years ago|reply
I have never understood the desire or need for these. Why not tackle whatever problems are in the way of what you are trying to make? I guess some people like them for their own sake, but I haven't ever felt that way.
[+] stan_rogers|13 years ago|reply
Some of these, at least, are excellent ways of learning how to think about a solution to a problem. Take the Friday the 13th puzzle for instance -- you can do a lot of floundering around with a puzzle like that in some languages until you realise that it's exactly equivalent to looking for all of the Sunday the 1st dates, and it's been a long time since I worked in any language that didn't have an easy way to do that. Sure, some puzzles are just puzzles for the sake of cleverness (the typical "think outside the box" things), but others are about decomposing or restating a problem to make it much simpler that a frontal assault on the original problem as stated. If you're the sort that can immediately intuit the decomposed problem all of the time, cool -- most people need to train their minds to work that way.
[+] franzus|13 years ago|reply
Yep, I too don't understand the fascination with puzzles. I love solving real problems but I hate those idiotic puzzles.
[+] prezjordan|13 years ago|reply
(plug) For a little while I tried to make some "practical" puzzles for new programmers [0], but with school and work I've found excuses to not work on it. I also began rewriting the site in Ruby on Rails so I could leave Wordpress, but, for the same reasons, I haven't worked on it in quite some time.

[0]: http://programthis.net

[+] eps|13 years ago|reply
For beginner programmers, though some of these make good questions for an interview. We used Roman number converter question few times and it's an unboring exercise.