[Java]Trie || Recursion
```\nclass MagicDictionary {\n    TrieNode root;\n    public MagicDictionary() {\n        root = new TrieNode();\n    }\n    \n    public void buildDict(String[
```\nclass MagicDictionary {\n    TrieNode root;\n    public MagicDictionary() {\n        root = new TrieNode();\n    }\n    \n    public void buildDict(String[] dictionary) {\n        for(String s: dictionary){\n            insertWord(s);\n        }\n    }\n    \n    public boolean search(String searchWord) {\n        return search(searchWord, true, root, 0);\n    }\n    \n    private boolean search(String word, boolean canVary, TrieNode root, int index){\n        TrieNode cur = root;\n        if(index == word.length())\n            return !canVary && root.eow;\n        for(int i=index;i<word.length();i++){\n            if(canVary){\n                for(int j=0;j<26;j++){\n                    if(cur.children[j]!=null){\n                        if(search(word, ((word.charAt(i)-\'a\')==j), cur.children[j], i+1))\n                            return true;\n                    }\n                }\n                return false;\n            } else {\n                if(cur.children[word.charAt(i)-\'a\']==null)\n                    return false;\n                cur = cur.children[word.charAt(i)-\'a\'];\n            }\n        }\n        return !canVary && cur.eow;\n    }\n    \n    private void insertWord(String word){\n        TrieNode cur = root;\n        for(int i=0;i<word.length();i++){\n            int x = word.charAt(i)-\'a\';\n            if(cur.children[x]==null)\n                cur.children[x]=new TrieNode();\n            cur = cur.children[x];\n        }\n        cur.eow = true;\n    }\n}\n\nclass TrieNode {\n    TrieNode[] children;\n    boolean eow;\n    public TrieNode(){\n        eow = false;\n        children = new TrieNode[26];\n    }\n}
['Trie', 'Java']