C# Dictionary solution beats 100%
\npublic class WordDictionary\n{\n    private Dictionary<int, List<string>> Map = new Dictionary<int, List<string>>(); // Length -> words\n    \n    public void
```\npublic class WordDictionary\n{\n    private Dictionary<int, List<string>> Map = new Dictionary<int, List<string>>(); // Length -> words\n    \n    public void AddWord(string word)\n    {\n        if (!Map.TryGetValue(word.Length, out var words))\n            Map.Add(word.Length, new List<string>{word});\n        else\n            words.Add(word);\n    }\n    \n    public bool Search(string word)\n    {\n        if (!Map.TryGetValue(word.Length, out var words))\n            return false;\n        foreach (var w in words)\n        {\n            var found = true;\n            for (var i = 0; i < word.Length; i++)\n            {\n                if (word[i] != \'.\' && word[i] != w[i])\n                {\n                    found = false;\n                    break;\n                }\n            }\n            if (found)\n                return true;\n        }\n        return false;\n    }\n}\n```\n\n![image](https://assets.leetcode.com/users/nex-54/image_1537693445.png)\n
[]