Kya Map use krna jaruri hain !? 🤔
Youtube Explanation\nhttps://youtu.be/p-xt3JibW-o\n# Intuition & Approach \n\n\n\n\n\n\n\n\n\n\n\n\n\n# Complexity\n- Time complexity: O(words.length * words[i]
# Youtube Explanation\nhttps://youtu.be/p-xt3JibW-o\n# Intuition & Approach \n![image.png](https://assets.leetcode.com/users/images/cdbca60d-f612-41d1-b060-cce315ab1368_1726113788.8503184.png)\n\n![image.png](https://assets.leetcode.com/users/images/6b06c417-c84e-4f88-a343-920f9afcf384_1726113803.885843.png)\n\n![image.png](https://assets.leetcode.com/users/images/520b84df-e9cd-4bce-9948-c9f787ca7ec6_1726113824.3264782.png)\n\n![image.png](https://assets.leetcode.com/users/images/9d550b01-3fc0-4a9e-895f-cda4b356164d_1726113845.1550965.png)\n\n![image.png](https://assets.leetcode.com/users/images/0218d0a1-edf9-42a3-afb9-ddde060cafd5_1726113861.4438205.png)\n\n![image.png](https://assets.leetcode.com/users/images/4d5d9871-9ad9-4973-899e-de1bd527f777_1726113886.32497.png)\n\n\n# Complexity\n- Time complexity: O(words.length * words[i].length)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code - 01\n```cpp []\nclass Solution {\npublic:\n    int countConsistentStrings(string allowed, vector<string>& words) {\n        vector<int> freq(27,0);\n        for(int i=0;i<allowed.size();i++){\n            int convert_ind = allowed[i] - \'a\';\n            // cout<<convert_ind<<" ";\n            freq[convert_ind] = 1;\n        }\n\n        int ans=0;\n\n        for(int i=0;i<words.size();i++){\n            string tmp = words[i];\n\n            bool fl = true;\n\n            for(int j=0;j<tmp.size();j++){\n                int convert_ind = tmp[j] - \'a\';\n                if(freq[convert_ind]==1){ continue; }\n                else{\n                    fl = false;\n                    break;\n                }\n            }\n\n            if(fl == true){ans++;}\n        }\n\n        return ans;\n    }\n};\n```\n# Code - 02\n``` cpp []\nclass Solution {\npublic:\n    int countConsistentStrings(string allowed, vector<string>& words) {\n        unordered_map<char,int> um;\n        for(int i=0;i<allowed.size();i++){\n            um[allowed[i]]++; // um[allowed[i]]=1;\n        }\n\n        int ans=0;\n\n        for(int i=0;i<words.size();i++){\n            string tmp = words[i];\n\n            bool fl = true;\n\n            for(int j=0;j<tmp.size();j++){\n                if(um.find(tmp[j]) != um.end()){\n                    continue;\n                }\n                else{\n                    fl=false;\n                    break;\n                }\n            }\n\n            if(fl){ans++;}\n        }\n\n        return ans;\n    }\n};\n```
['Array', 'Hash Table', 'String', 'Bit Manipulation', 'Counting', 'C++']