242 有效的字母异位词

class Solution {
public:
    bool isAnagram(string s, string t) {
        unordered_map<char, int> S, T;
        for(auto i : s) ++S[i];
        for(auto i : t) ++T[i];
        return S == T ? true : false;
    }
};
发布了21 篇原创文章 · 获赞 32 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/include_not_found_/article/details/104896611