Let’s say a friend of mine was interested in employment with a company called Zamazon. Let’s further pretend that he recently had a phone interview with Zamazon. Continuing this thought game, let’s imagine Zamazon asked this friend the following question:
You are given a word list/dictionary with several thousand words. You are then provided two words, a start word and an end word. For example
Start: corn
End: barn
Your task is to use the dictionary to provide the shortest path (from the dictionary words) from the start word to the end word in single character-changing iterations. For our example, the answer might be: corn -> cord -> card -> bard -> barn
(where cord, card and bard appear in the dictionary.)
Who’s up for the challenge?
Beau Scott, a man with a soul patch, coded up an elegant php solution in just an hour or two. Strong work, Beau!