Skip to content

Instantly share code, notes, and snippets.

@spotco
Last active December 14, 2015 00:59
Show Gist options
  • Save spotco/5003017 to your computer and use it in GitHub Desktop.
Save spotco/5003017 to your computer and use it in GitHub Desktop.
Sentence solver problem code
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.HashSet;
public class SentenceSolver {
public static Set<String> EnglishDictionary;
static {
EnglishDictionary = new HashSet<String>(Arrays.asList(new String[] {
"a","apple","bee","corn","dad","ear","eat","fine","finger","gel","harden","just","kids","lump","lol","money","nope","oppa","person","queen","read","super","the","upper","verse","wut","xenoblade","yes","zed"
}));
}
public static void main(String[] args) {
System.out.println(get_sentence("appleeatkids")); //should return ["apple","eat","kids"]
}
/**
* Uses EnglishDictionary to construct list of words in sentence given sentence with spaces removed
* (ex. input "applecornkids" could return ["apple", "corn", "kids"] )
* @param input - sentence (containing only words in EnglishDictionary) with no spaces between words
* @return list of words in input sentence
*/
public static List<String> get_sentence(String input) {
return null; //TODO -- fix me!
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment