Skip to content

Latest commit

 

History

History
17 lines (14 loc) · 330 Bytes

1684. 统计一致字符串的数目.md

File metadata and controls

17 lines (14 loc) · 330 Bytes
/**
 * @param {string} allowed
 * @param {string[]} words
 * @return {number}
 */
var countConsistentStrings = function (allowed, words) {
   
    allowed = new Set(allowed);

    return words.reduce((count, word) => {
        count += +[...word].every(w => allowed.has(w));
        return count;
    }, 0);
};