MCPcopy
hub / github.com/qiyuangong/leetcode / palindromePairs

Method palindromePairs

java/336_Palindrome_Pairs.java:15–29  ·  view source on GitHub ↗
(String[] words)

Source from the content-addressed store, hash-verified

13 }
14
15 public List<List<Integer>> palindromePairs(String[] words) {
16 List<List<Integer>> res = new ArrayList<>();
17
18 TrieNode root = new TrieNode();
19
20 for (int i = 0; i < words.length; i++) {
21 addWord(root, words[i], i);
22 }
23
24 for (int i = 0; i < words.length; i++) {
25 search(words, i, root, res);
26 }
27
28 return res;
29 }
30
31 private void addWord(TrieNode root, String word, int index) {
32 for (int i = word.length() - 1; i >= 0; i--) {

Callers

nothing calls this directly

Calls 2

addWordMethod · 0.95
searchMethod · 0.95

Tested by

no test coverage detected