(String[] words)
| 20 | }*/ |
| 21 | |
| 22 | public String longestWord(String[] words) { |
| 23 | Trie trie = new Trie(); |
| 24 | int index = 0; |
| 25 | for (String word: words) { |
| 26 | trie.insert(word, ++index); //indexed by 1 |
| 27 | } |
| 28 | trie.words = words; |
| 29 | return trie.dfs(); |
| 30 | } |
| 31 | } |
| 32 | class Node { |
| 33 | char c; |