class Solution {
public:
bool canConstruct(string ransomNote, string magazine) {
vector<int> v(26);
for(auto letter : magazine) {
v[letter - 'a']++;
}
for(auto letter : ransomNote) {
if(v[letter - 'a'] == 0) return false;
v[letter - 'a']--;
}
return true;
}
};
? ? ? ? 看见字母就要考虑数组来做哈希表