Trie Tree java solution! very easy to understand!
This solution uses Trier tree and DFS to search '.' case.\n\n    1, first build the standard trier tree root.\n    2, add the word into the tree.\n    3, basic 
This solution uses Trier tree and DFS to search '.' case.\n\n    1, first build the standard trier tree root.\n    2, add the word into the tree.\n    3, basic search for normal character 'a'-'z' and DFS for the '.'\n\nHere is the solution, it is fast that beat 80%-90% solutions.\n\n    public class WordDictionary {\n    \n        // Adds a word into the data structure.\n        Trier root = new Trier();\n        public void addWord(String word) {\n            Trier pointer = root;\n            for(int i = 0; i < word.length(); i++) {\n                char c = word.charAt(i);\n                if (pointer.children[c-'a'] == null) {\n                    pointer.children[c-'a'] = new Trier();\n                    pointer = pointer.children[c-'a'];\n                } else {\n                    pointer = pointer.children[c-'a'];\n                }\n            }\n            pointer.flag = true;\n        }\n    \n        // Returns if the word is in the data structure. A word could\n        // contain the dot character '.' to represent any one letter.\n        public boolean search(String word) {\n            Trier pointer = root;\n            return helper(word,0,pointer);\n        }\n        private boolean helper(String word, int start, Trier cur) {\n            if (start == word.length()) {\n                if (cur.flag) {\n                    return true;\n                } else {\n                    return false;\n                }\n            }\n            char c = word.charAt(start);\n            if (c == '.') {\n                for (int i = 0; i < 26; i++) {\n                    if (cur.children[i] != null) {\n                        if (helper(word,start+1,cur.children[i])) {\n                            return true;\n                        }\n                    }\n                }\n            } else {\n                if (cur.children[c-'a'] == null) {\n                    return false;\n                } else {\n                    return helper(word,start+1,cur.children[c-'a']);\n                }\n            }\n            return false;\n        }\n        class Trier {\n            Trier[] children;\n            char c;\n            boolean flag;\n            public Trier() {\n                children = new Trier[26];\n                flag = false;\n            }\n        }\n    }
['Java']