beats 100% percent ..C++ easy
\n# Code\n\nclass Solution {\npublic:\n  int find(int x , vector<int> & parents)\n  {\n     return parents[x] == x ? x : find(parents[x],parents);\n  }\n    str
\n# Code\n```\nclass Solution {\npublic:\n  int find(int x , vector<int> & parents)\n  {\n     return parents[x] == x ? x : find(parents[x],parents);\n  }\n    string smallestEquivalentString(string s1, string s2, string baseStr) {\n\n        vector<int> parents(26);\n\n        for(int i = 0 ; i < 26 ; i++)\n        parents[i] = i ;\n\n        for(int i = 0 ; i < s1.length() ; i++)\n        {\n            int x = find(s1[i] -\'a\',parents);\n            int y = find(s2[i] -\'a\',parents);\n\n            if(x != y)\n            parents[max(x,y)] = min(x,y);\n        }\n\n        for(int i = 0 ; i < baseStr.length();i++)\n        baseStr[i] = find(baseStr[i] -\'a\' , parents) + \'a\';\n        \n        return baseStr ;\n    }\n};\n```
['Union Find', 'C++']