【leetcode】赎金信

bool canConstruct(char * ransomNote, char * magazine){
    int hash[26] = {0},i;
    for (i=0; magazine[i] != ''; i++) {
        hash[magazine[i]-97]++;
    }
    for (i=0; ransomNote[i] != ''; i++){
        if (!hash[ransomNote[i]-97]--) return false;
    }
    return true;
}
原文地址:https://www.cnblogs.com/ganxiang/p/13645377.html