💢☠💫Easiest👾Faster✅💯 Lesser🧠 🎯 C++✅Python3🐍✅Java✅C✅Python🐍✅C#✅💥🔥💫Explained☠💥🔥 Beats 100
Intuition\n\n Describe your first thoughts on how to solve this problem. \n- JavaScript Code --> https://leetcode.com/problems/count-the-number-of-consistent-st
# Intuition\n![0ehh83fsnh811.jpg](https://assets.leetcode.com/users/images/78ee63aa-19c5-4d29-a0eb-2eaee80745e4_1726120590.2677093.jpeg)\n<!-- Describe your first thoughts on how to solve this problem. -->\n- ***JavaScript Code -->*** https://leetcode.com/problems/count-the-number-of-consistent-strings/submissions/1387340494?envType=daily-question&envId=2024-09-12\n- ***C++ Code -->*** https://leetcode.com/problems/count-the-number-of-consistent-strings/submissions/1387158655?envType=daily-question&envId=2024-09-12\n- ***Python3 Code -->*** https://leetcode.com/problems/count-the-number-of-consistent-strings/submissions/1387306511?envType=daily-question&envId=2024-09-12\n- ***Java Code -->*** https://leetcode.com/problems/count-the-number-of-consistent-strings/submissions/1171188381?envType=daily-question&envId=2024-09-12\n- ***C Code -->*** https://leetcode.com/problems/count-the-number-of-consistent-strings/submissions/1171191663?envType=daily-question&envId=2024-09-12\n- ***Python Code -->*** https://leetcode.com/problems/count-the-number-of-consistent-strings/submissions/1387311933?envType=daily-question&envId=2024-09-12\n- ***C# Code -->*** https://leetcode.com/problems/count-the-number-of-consistent-strings/submissions/1387316430?envType=daily-question&envId=2024-09-12\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n     O(N * M)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n     O(1)\n# Code\n```javascript []\n/**\n * @param {string} allowed\n * @param {string[]} words\n * @return {number}\n */\nvar countConsistentStrings = function(allowed, words) {\n    const arr = Array(26).fill(false);\n    for (let w of allowed){\n        let idx = w.charCodeAt(0) - \'97\'\n        //console.log(idx)\n        arr[idx] = true\n    }\n    let cnt = 0\n    for (let word of words){\n        for (let ch of word){\n            let idx = ch.charCodeAt(0) - \'97\'\n            if (arr[idx] === false){\n                cnt++\n                break\n            }\n        }\n    }\n    return words.length - cnt\n};\n```\n![th.jpeg](https://assets.leetcode.com/users/images/a6715579-ea35-4ce4-979c-84d1c592370d_1726120778.030227.jpeg)\n
['Array', 'Hash Table', 'Bit Manipulation', 'C', 'Python', 'C++', 'Java', 'Python3', 'JavaScript', 'C#']