Coder2013333
Coder2013333

Reputation: 149

Algorithm/code to return strings containing 26 letters of alphabet from dictionary

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

Answers (2)

Cybercartel
Cybercartel

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

Chris Laplante
Chris Laplante

Reputation: 29658

return 'abcdefghijklmnopqrstuvwxyz';

They never said you had to read the files.

Upvotes: 1

Related Questions