C++ 62ms beats 100%
Solution 1\n\nHash Table, 62ms, 100%.\n\nclass WordDictionary {\npublic:\n    WordDictionary() {}\n    \n    void addWord(string word) {\n        words[word.siz
**Solution 1**\n\nHash Table, 62ms, 100%.\n```\nclass WordDictionary {\npublic:\n    WordDictionary() {}\n    \n    void addWord(string word) {\n        words[word.size()].push_back(word);\n    }\n    \n    bool search(string word) {\n        for(auto s: words[word.size()]) if(isEqual(s, word)) return true;\n        return false;\n    }\n    \nprivate:\n    unordered_map<int, vector<string>>words;\n    \n    bool isEqual(string a, string b){\n        for(int i = 0; i < a.size(); i++){\n            if(b[i] == '.') continue;\n            if(a[i] != b[i]) return false;\n        }\n        return true;\n    }\n};\n```\n***\n**Solution 2**\n\nTrie, 88ms.\n```\nstruct TrieNode{\n    bool isKey;\n    TrieNode* next[26];\n    TrieNode():isKey(false){\n        memset(next, NULL, sizeof(next));\n    }\n};\n\nclass WordDictionary {\npublic:\n    WordDictionary() {\n        root = new TrieNode();\n    }\n    \n    void addWord(string word) {\n        TrieNode* node = root;\n        for(auto c: word){\n            if(!node->next[c - 'a']) node->next[c - 'a'] = new TrieNode();\n            node = node->next[c - 'a'];\n        }\n        node->isKey = true;\n    }\n    \n    bool search(string word) {\n        return helper(word, root);\n    }\n\nprivate:\n    TrieNode* root;\n    \n    bool helper(string word, TrieNode* node){\n        for(int i = 0; i < word.size(); i++){\n            char c = word[i];\n            if(c != '.'){\n                if(!node->next[c - 'a']) return false;\n                node = node->next[c - 'a'];\n            }\n            else{\n                bool found = false;\n                int j = 0;\n                for(; j < 26; j++){\n                    if(node->next[j]) found |= helper(word.substr(i + 1), node->next[j]);\n                    if(found) return true;\n                }\n                if(j == 26) return false;\n            }\n        }\n        return node->isKey;\n    }\n};\n```
['C++']