You are viewing a single comment's thread. Return to all comments →
Here is my c++ solution, you can watch the explanation here : https://youtu.be/B4pZbX0VzzU
#include <bits/stdc++.h> using namespace std; int main() { string fstr, sstr; cin >> fstr; cin >> sstr; vector<int>fsc(26,0), ssc(26,0); int i, result = 0; for(i = 0; i < fstr.size(); i++) fsc[fstr[i] - 'a']++; for(i = 0; i < sstr.size(); i++) ssc[sstr[i] - 'a']++; for(i = 0; i < 26; i++) result += abs(fsc[i] - ssc[i]); cout << result << endl; return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Making Anagrams
You are viewing a single comment's thread. Return to all comments →
Here is my c++ solution, you can watch the explanation here : https://youtu.be/B4pZbX0VzzU