The game goes like this: The player inputs a number of vowels in [0..10]. We generate 10-input(vowels) consonants to finally display 10 letters unordered. The player then tries to form the longest word possible with the given letters.
The problem: we have a dictionary of important size to go through to find if the word is valid.
What is the best way to search through it? My best two ideas are: 1) Seperate the word in different files indexed by the number of vowels inside the words stored in it. 2) Use Streamer(). filter method using a function that returns the number of vowels in a word.
Both seem very expensive in term of time complexity (i don't know if im using the term correctly).
I hope i was clear enough.
Aucun commentaire:
Enregistrer un commentaire