(TrieNode root, String word, int index)
| 29 | } |
| 30 | |
| 31 | private void addWord(TrieNode root, String word, int index) { |
| 32 | for (int i = word.length() - 1; i >= 0; i--) { |
| 33 | int j = word.charAt(i) - 'a'; |
| 34 | |
| 35 | if (root.next[j] == null) { |
| 36 | root.next[j] = new TrieNode(); |
| 37 | } |
| 38 | |
| 39 | if (isPalindrome(word, 0, i)) { |
| 40 | root.list.add(index); |
| 41 | } |
| 42 | |
| 43 | root = root.next[j]; |
| 44 | } |
| 45 | |
| 46 | root.list.add(index); |
| 47 | root.index = index; |
| 48 | } |
| 49 | |
| 50 | private void search(String[] words, int i, TrieNode root, List<List<Integer>> res) { |
| 51 | for (int j = 0; j < words[i].length(); j++) { |
no test coverage detected