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; } };
标签:26,string,++,auto,mt,Valid,str,Anagram,leetcode 来源: https://www.cnblogs.com/LiuQiujie/p/12572762.html