I recently started reading the book Programming Pearls. It walks through several situations in software development which had interesting solutions. The solutions generally required a bit more thought about a problem than a person might initially give it, but were far simpler to write and/or more efficient than the first solution most people would think of as well.

This also includes exercises after each section which reinforce some of the concepts and ways of thinking used to solve the initial problem. I intend to do some of these and occasionally post my answers. The book used C++ and I may do some in C++ just for the experience. I'm more concerned with the higher level thought process and so will probably do most of these in Python, which is what I use most of the time these days, or possibly a different language which seems like it would be a good fit for the specific problem.

Here's the first one that I am posting.