题解 | #确定两串乱序同构#
确定两串乱序同构
http://www.nowcoder.com/practice/164929d4acd04de5b0ee2d93047b3b20
class Same {
public:
bool checkSam(string stringA, string stringB) {
// write code here
map<char, int> mp;
for (int i = 0; i < stringA.size(); ++i)
mp[stringA[i]]++;
for (int i = 0; i < stringB.size(); ++i)
mp[stringB[i]]--;
for (auto it : mp)
if (it.second != 0)
return false;
return true;
}
};