Easiest and understandable code
just change each word and check in trie\nTIME COMPLEXITY(n26logm)\n\n\nclass MagicDictionary {\n\n    class Trie\n    {\n        boolean end;\n        Trie node
just change each word and check in trie\nTIME COMPLEXITY(n*26*logm)\n\n```\nclass MagicDictionary {\n\n    class Trie\n    {\n        boolean end;\n        Trie node[]=new Trie[26];\n        Trie()\n        {\n            end=false;\n            for(int i=0;i<26;i++)\n            {\n                node[i]=null;\n            }\n        }\n    }\n   \n   static Trie Dict;\n    public MagicDictionary() \n    {\n        Dict=new Trie();\n    }\n    \n    public void buildDict(String[] dictionary) \n    {\n        int m=dictionary.length;\n        for(int j=0;j<m;j++)\n        {\n            String s=dictionary[j];\n            Trie ap=Dict;\n            int n=s.length();\n            for(int i=0;i<n;i++)\n            {\n                if(ap.node[s.charAt(i)-\'a\']==null)\n                {\n                    Trie newnode=new Trie();\n                    ap.node[s.charAt(i)-\'a\']=newnode;\n                }\n                ap=ap.node[s.charAt(i)-\'a\'];\n            }\n\n            ap.end=true;\n        }\n    }\n    public static boolean check(char ch[])\n    {\n        Trie check1=Dict;\n        for(int i=0;i<ch.length;i++)\n        {\n            if(check1.node[ch[i]-\'a\']!=null)\n            {\n                check1=check1.node[ch[i]-\'a\'];\n            }\n            else\n            {\n                return false;\n            }\n        }\n        if(check1.end==true)\n        {\n            return true;\n        }\n        return false;\n    }\n    public boolean search(String searchWord)\n    {\n        int n=searchWord.length();\n        char ch[]=searchWord.toCharArray();\n        for(int i=0;i<n;i++)\n        {\n         for(int j=0;j<26;j++)\n           {\n             if(ch[i]==(j+97))\n             {\n               continue;      \n             }\n             char op=ch[i];\n             ch[i]=(char)(j+97);\n             if(check(ch))\n             {\n                 return true;\n             }\n             ch[i]=op;\n           }\n             \n        }\n        return false;\n        \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 * boolean param_2 = obj.search(searchWord);\n */\n```\n\n\n**PLS UPVOTE IF U LIKE THE SOLUTION**
['Depth-First Search', 'Trie', 'Java']