Last active
December 14, 2015 00:59
-
-
Save spotco/5003017 to your computer and use it in GitHub Desktop.
Sentence solver problem code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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