leetcode 242 Valid Anagram

class Solution {
public:
    bool isAnagram(string s, string t) {
        vector<int> ms(26,0),mt(26,0);
        for(auto& str:s) ++ms[str-'a'];
        for(auto& str:t) ++mt[str-'a'];
        for(int i=0;i<26;++i) {
            if(ms[i]!=mt[i]) return false;
        }
        return true;
    }
};
原文地址:https://www.cnblogs.com/LiuQiujie/p/12572762.html