C++ Solution beats 100% time and memory
Explanation:\nHere, an unordered map of vectors is taken which is acting as a Hash Map. Words are stored with respect to their sizes in the corresponsing vector
**Explanation:**\nHere, an unordered map of vectors is taken which is acting as a Hash Map. Words are stored with respect to their sizes in the corresponsing vector in the hashmap. We iterate particular vector corresponding to the size of the supplied word to search (hence decreasing the time complexity). The given word is checked with each of the strings of corresponding vector and if there\'s no string that matches the character wrt to the *search criteria* then we return false else we return true.\n\n**Search Criteria:** \n* If all the characters are same - return true\n* If some characters are different but there is a \'.\' character in the supplied word instead of the given character in the correspnding string (of vector) - return true \n* All other cases - return false\n\n**C++ Solution (beats 100% time and memory): **\n\n\n```\nunordered_map<int, vector<string>>m;\n    WordDictionary() {\n        \n    }\n    \n    void addWord(string word) {\n        m[word.length()].push_back(word);\n    }\n    \n    bool search(string word) {\n        bool flag = false;\n        for(auto w: m[word.size()])\n        {\n                flag = true;\n                for(int i=0;i<w.length();i++)\n                {\n                    if(w[i]!=word[i] && word[i]!=\'.\')\n                    {\n                        flag =false;\n                        break;\n                    }\n                }\n            if(flag)\n                break;\n        }\n        if(flag) return true;\n        return false;\n}\n```\n\n
['C']