C++ solution + DFS  #easyToUnderstand
Intuition\nIn order to find the minimum character that can be replaced, we have to run dfs for each character in baseStr.\n\n# Approach\nDepth first search\n\n<
# Intuition\nIn order to find the minimum character that can be replaced, we have to run dfs for each character in baseStr.\n\n# Approach\nDepth first search\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\n## Don\'t forget to upvote and give a like \uD83D\uDE43\n\n# Code\n```\nclass Solution {\npublic:\n    char need;\n    void dfs(char x,map<char,vector<char>>& mp,char parent,map<char,int>& vischeck){\n        vischeck[x] = 1;\n        for(auto i : mp[x]){\n            if(i!=parent and vischeck[i]!=1){\n            need = min(need,i);\n            dfs(i,mp,x,vischeck);\n            }\n        }\n    }\n    string smallestEquivalentString(string s1, string s2, string baseStr) {\n        int n = s1.size();\n        map<char,vector<char> > mp;\n        for(int i=0;i<n;i++){\n            mp[s1[i]].push_back(s2[i]);\n            mp[s2[i]].push_back(s1[i]);\n        }\n        string ans;\n        map<char,char> vis; //stores smallest character corresponding to a given character\n        for(int i = 0;i<baseStr.size();i++){\n            if(mp.find(baseStr[i])==mp.end()){\n                ans+=baseStr[i];\n            }\n            else if(vis.find(baseStr[i])==vis.end()){\n                need = baseStr[i]; // base condition\n                map<char,int> vischeck; // stores the visited characters\n                dfs(baseStr[i],mp,\'0\',vischeck); //dfs\n                vis[baseStr[i]] = need; //storing the result\n                ans+=need;\n            }\n            else{\n                ans+=vis[baseStr[i]];\n            }\n            \n        }\n        return ans;\n\n\n    }\n};\n```\n\n### I hope the solution is clear; use the comment section regarding any doubt.
['Hash Table', 'Depth-First Search', 'Graph', 'C++']