(String w)
| 32 | } |
| 33 | |
| 34 | private boolean dfs(String w) { |
| 35 | if ("".equals(w)) { |
| 36 | return true; |
| 37 | } |
| 38 | Trie node = trie; |
| 39 | for (int i = 0; i < w.length(); ++i) { |
| 40 | int idx = w.charAt(i) - 'a'; |
| 41 | if (node.children[idx] == null) { |
| 42 | return false; |
| 43 | } |
| 44 | node = node.children[idx]; |
| 45 | if (node.isEnd && dfs(w.substring(i + 1))) { |
| 46 | return true; |
| 47 | } |
| 48 | } |
| 49 | return false; |
| 50 | } |
| 51 | } |
no test coverage detected