EASY TRIE SOLUTION C++
Intuition\ninsert all the string in the trie \nIn search operation traverse the whole seachString, \nif trie does not contains that char then skip the curr char
# Intuition\ninsert all the string in the trie \nIn search operation traverse the whole seachString, \nif trie does not contains that char then skip the curr character and check if u can find the remaining substring (implemented in helper function) return true else return false and if trie does contain that char then we have option to skip that character or not to skip that character so try by skipping this char if u find remaining substring by any other path, then return true else check further by moving to the next index\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nstruct Node {\n    Node * links[26];\n    bool flag = false;\n    bool isContains(char ch){       // Node has ch or not\n        return links[ch-\'a\'] != NULL;\n    }\n    void put (char ch, Node * node){\n        links[ch-\'a\'] = node;\n    }\n    Node* get(char ch){\n        return links[ch-\'a\'];\n    }\n};\nclass MagicDictionary {\npublic:\n    Node * root ;\n    MagicDictionary() {\n        root = new Node();\n    }\n    \n    void buildDict(vector<string> dictionary) {             // same as insert just wrap insert all the strings in dict\n        for(auto word : dictionary){\n            Node * node = root;\n            int n = word.size();\n            for(int i = 0;i<n;i++){\n                if(!(node ->isContains(word[i]))){   // if node doesn\'t contain word[i]\n                    node->put(word[i],new Node());\n                }\n                node = node->get(word[i]);          // move forward\n            }\n            node->flag = true;                  // word end\'s here mark flag as true \n        }\n    }\n    \n    bool search(string searchWord) {\n        Node * node = root;\n        int n = searchWord.size();\n        for(int i = 0;i<n;i++){\n            if(!node->isContains(searchWord[i])){       // if we don\'t find same char then skip this char and check if we found rem substring if yes return true else false\n                string s = searchWord.substr(i+1);\n                for(int j = 0;j<26;j++){\n                    Node * curr = node->get(j + \'a\');\n                    if(curr){\n                        if(SearchHelper(s,curr))\n                            return true;\n                    }\n                }\n                return false;\n            }\n            else {             // if we find same char then we have option to skip and notskip so check by skpping this char and if we found rem substring return true else move to next character\n                string s = searchWord.substr(i+1);\n                int k = searchWord[i] - \'a\';\n                for(int j = 0;j<26;j++){\n                    if(j == k) continue;\n                    Node * curr = node->get(j + \'a\');\n                    if(curr){\n                        if(SearchHelper(s,curr))\n                            return true;\n                    }\n                }\n                node = node->get(searchWord[i]);\n            }\n        }\n        return false;\n    }\n    bool SearchHelper(string word, Node * node){        // normal search for same string we are callling this function after skipping a char so if we found remaining string i.e we need to change 1 char to convert a string into matching string\n        int n = word.size();\n        for(int i = 0;i<n;i++){\n            if(!node ->isContains(word[i])){      // if node doesn\'t contain word[i]\n                return false;\n            }\n            node = node->get(word[i]);          // move forward\n        }\n        return node->flag;                  // if it contains all the char and flag is true at last it means word is here   \n    }\n};\n\n/**\n * Your MagicDictionary object will be instantiated and called as such:\n * MagicDictionary* obj = new MagicDictionary();\n * obj->buildDict(dictionary);\n * bool param_2 = obj->search(searchWord);\n */\n```
['Trie', 'C++']