Archive for September, 2006

WordLadder Coding Challenge

Recently a co-worker of mine was interviewing with a large internet retailer of some Brazillian-jungle influence, and was asked to write a word ladder application in Java using a given dictionary. The object of the application was to find the shortest transform path from word A to word B using one-letter word-variants. For example to get from “load” to “bald” the ladder would look like this:

load -> lord -> lard -> bard -> bald

After going over the basic restrictions I decided it would be fun to launch a code challenge to my readers. After JavaScript, PHP is my language of choice, so I set out to code up an example of what this WordLadder might be. Of course, to keep in in queue with the AJAX tone of this site, I made the interface all pretty with prototype.js and scriptaculous.So here’s the challenge: I want to see your best efforts in creating this application using your language of choice. Here are the requirements:

  • It must use the same dictionary file I use. (Click here to download this dictionary file)
  • It must find the SHORTEST path, not just any path
  • It must be web-accessible. So if you write it in C, you must have a way of calling it through a web interface.
  • It must be usably fast.
  • It must be able to handle up to 5-letter words. If you go over that and it’s usable then you get bonus points.
  • For more bonus points, make a slick interface to it using Ajax (any framework you want)

Of course there’s no real reward to the challenge other than a kudos to you for exercising your mind :)

Click here to see my working example

BeauScott.com is Digg proof thanks to caching by WP Super Cache!