哈希表 383.赎金信

 统计两个字符串中,每个字母出现的次数,最后统计,当数组所有位置都>0时,就能确定。

class Solution {
    public boolean canConstruct(String ransomNote, String magazine) {
        int [] record = new int[26];
        if(ransomNote.length() > magazine.length()){
            return false;
        }
        for(int i = 0; i

你可能感兴趣的:(散列表,算法,leetcode)