share
Stack OverflowWhat are some interesting coding exercises?
[+46] [10] abyx
[2008-08-06 21:17:36]
[ self-improvement homework ]
[ http://stackoverflow.com/questions/4002] [DELETED]

How do you practice coding? I've seen the great CodeKata [1] and also Steve Yegge's Practicing Programming [2].

What are some more interesting exercises?

The name of that site is "CodeKata" not "Code Katas"; "can anyone .." is a yes/no question, what you really want to ask is "what are some more .."; the title "Code Katas" is too short and is automatically rejected by the system; greetings and signatures ("thanks!") are currently considered out of place on SO (see Meta); the [best-practices] tag is out of place, and [coding] (at least currently) has lost any specific meaning (effectively all programming involves "coding", right?). - community_owned
This is one of the best questions on stackoverflow? 33 upvotes? wiki, please. - typeoneerror
Contribute to github.com/wbailey/code_katas - Wes
[+16] [2008-08-06 21:26:25] saniul [ACCEPTED]

Jeff's Code Kata (from this [1] post):

I don't have a long list of effortful study advice like Steve and Peter and Dave do. I'm far too impatient for that. In fact, there are only two movements in my book of code kata:

  1. Write a blog. I started this blog in early 2004 as a form of effortful study. From those humble beginnings it has turned into the most significant thing I've ever done in my professional life. So you should write blogs, too. The people who can write and communicate effectively are, all too often, the only people who get heard. They get to set the terms of the debate.

  2. Actively participate in a notable open source project or three. All the fancy blah blah blah talk is great, but are you a talker or a doer? This is critically important, because you will be judged by your actions, not your words. Try to leave a trail of public, concrete, useful things in your wake that you can point to and say: I helped build that.

When you can write brilliant code and brilliant prose explaining that code to the world -- well, I figure that's the ultimate code kata.

As far as interesting exercises and challenges are concerned, you could try looking at some stuff from TopCoder [2] or Google Code Jam [3]

[1] http://www.codinghorror.com/blog/archives/001138.html
[2] http://www.topcoder.com/
[3] http://code.google.com/codejam/

1
[+12] [2008-08-06 21:19:09] Patrick

Project Euler [1] and Anarchy Golf [2] are two of my favorite sites for simple programming exercises.

[1] http://projecteuler.net/
[2] http://www.shinh.org/

2
[+8] [2008-08-06 21:18:50] Justin Standard

Check out the Bowling Game Kata [1] for practice in Test Driven Development.

[1] http://butunclebob.com/ArticleS.UncleBob.TheBowlingGameKata

+1 Seems really interesting! - BengtBe
3
[+6] [2008-09-26 15:43:01] Black Horus

A great article by Peter Norvig: Teach Yourself Programming in Ten Years [1]

[1] http://www.norvig.com/21-days.html

4
[+6] [2008-08-06 21:42:09] Joey deVilla

Python Challenge [1] is an interesting set of 33 puzzles which you solve by writing little programs in Python -- although there's no reason you can't use the language of your choice.

[1] http://www.pythonchallenge.com/

5
[+4] [2009-07-02 14:47:47] BengtBe

The Monopoly - The Game [1] code kata seems interesting. It is good to try some code katas that are not just mathematically puzzles. Below is sample from the first release called Basic Board and Player Movement:

For this first release, we want to be able to support the basic player movement. All players start on the first location. The players' order is initially determined randomly and then maintained for the remainder of the game. Each player takes a turn, during which they roll a pair of dice, move from their current location to a destination calculated based on their current location plus the roll of the dice. The board has a total of 40 locations. When the player reaches the end of the board, s/he starts back at the beginning again. Since this version is so simple, we'll simply play a total of 20 rounds, where a round means every player takes a turn.

[1] http://schuchert.wikispaces.com/Katas.MonopolyTheGame%28r%29

6
[+3] [2010-09-12 22:04:47] kuszi

CodeChef [1] and SPOJ [2] rocks.

[1] http://codechef.com
[2] http://spoj.pl

7
[+1] [2010-07-11 20:01:02] community_owned

I've enjoyed several of the Programming Praxis [1] exercises.

[1] http://programmingpraxis.com/

8
[+1] [2008-08-06 21:50:25] Joey deVilla

D'oh! Forgot about Ruby Quiz [1] and Perl Quiz of the Week [2]!

[1] http://rubyquiz.com/
[2] http://perl.plover.com/qotw/

9
[0] [2008-08-10 06:21:56] Tao Zhyn

You want some more interesting problem solving questions. Try programming contest practice questions.

UVA online-judge [1] provides a huge list of problems and allows you to submit your answers to see if they are correct. Here are a few [2] sample [3] questions [4].

Another useful site is Hunting UVA Problems [5]. It will create a list of problems that are roughly the next easiest for you. You will need to sign up to UVA online-judge before using this tool.

[1] http://icpcres.ecs.baylor.edu/onlinejudge/
[2] http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&Itemid=8&category=3&page=show_problem&problem=67
[3] http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&Itemid=8&category=3&page=show_problem&problem=87
[4] http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&Itemid=8&category=3&page=show_problem&problem=53
[5] http://felix-halim.net/uva/hunting.php

10