Reputation: 149
Need help/solution for the following interview question: From a folder containing several files whose contents are the english dictionary, return a string or strings that, between them, contain all 26 letters of the alphabet. Improve this for speed. Provide alternate ways of doing this.
All help is appreciated! Thanks very much!
Upvotes: 0
Views: 236
Reputation: 12592
I think the question is about an efficient trie. Look for a ternary search tree. It's a efficient space saving version of the original trie where each node has 26 leafs (like the alphabet). A simple trie can also be create from an array look for example here http://phpir.com/tries-and-wildcards/
Upvotes: 0
Reputation: 29658
return 'abcdefghijklmnopqrstuvwxyz';
They never said you had to read the files.
Upvotes: 1