|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object StateSpeller
public class StateSpeller
This class contains methods for solving The following puzzle, presented by Will Shortz on NPR's weekend edition on February 19th, 2012:
The word marten, as in the animal, consists of the beginning letters of Mississippi, Arkansas, Texas, and New Mexico. And you can actually drive from Mississippi to Arkansas to Texas to New Mexico, in that order. What is the longest common English word you can spell by taking the beginning letters of consecutive states in order, as you travel through them? My answer has eight letters. Maybe you can better mine. The longest answer will win.
Constructor Summary | |
---|---|
StateSpeller(WordTree wordTree,
StateGraph stateGraph)
Construct a StateSpeller. |
Method Summary | |
---|---|
java.util.ArrayList<java.lang.String> |
anyWords(int minLength)
Return an ArrayList of solution strings where each string represents a word that can be created by driving from one state to the next using the beginning letters of each state name. |
java.util.ArrayList<java.lang.String> |
firstLetterWords(int minLength)
Return an ArrayList of solution strings where each string represents a word that can be created by driving from one state to the next using the first letter of each state name. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StateSpeller(WordTree wordTree, StateGraph stateGraph)
wordTree
- Initialized word tree.stateGraph
- Initialized state graph.Method Detail |
---|
public java.util.ArrayList<java.lang.String> firstLetterWords(int minLength)
word length [state1, state2, ... , stateN]Where word is an English word and length is the number of letters in that word. All solutions at least as long as minLength will be returned.
minLength
- The minimum solution length
public java.util.ArrayList<java.lang.String> anyWords(int minLength)
word length [state1, state2, ... , stateN]Where word is an English word and length is the number of letters in that word. All solutions at least as long as minLength will be returned.
minLength
- The minimum solution length
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |