📌FAANG😎 OPTIMISED CODE | Easy Beginner friendly Soln.
Upvote \uD83D\uDE4F\n# *\uD83D\uDC38Approach-1 (Bit-Manipulation) TC: O(n^2) SC: O(n)\n\nclass Solution {\npublic:\n    int countConsistentStrings(string allowe
## **Upvote** \uD83D\uDE4F\n# ****\uD83D\uDC38Approach-1 (Bit-Manipulation) TC: O(n^2) SC: O(n)****\n```\nclass Solution {\npublic:\n    int countConsistentStrings(string allowed, vector<string>& words) {\n        int res=0;\n        for(int i=0;i<allowed.size();i++){\n            res |= 1 << (allowed[i]-\'a\');\n        }\n        int c=0;\n        for(int i=0;i<words.size();i++){\n            int c1=0;\n            for(int j=0;j<words[i].size();j++){\n                if(res & (1<<(words[i][j]-\'a\'))){\n                    c1++;\n                }\n                if(c1==words[i].size())\n                    c++;          \n            }\n        }\n        return c;\n        \n    }\n};\n```\n# ****\uD83D\uDC38Approach-2 (Unordered Set) TC: O(n^2) SC: O(n)****\n```\nclass Solution {\npublic:\n    int countConsistentStrings(string allowed, vector<string>& words) {\n        unordered_set <char> st(allowed.begin(),allowed.end());\n        \n        int c=0;\n        for(int i=0;i<words.size();i++){\n            int c1=0;\n            for(int j=0;j<words[i].size();j++){\n                if(st.count(words[i][j])){\n                    c1++;\n                }\n                if(c1==words[i].size())\n                    c++;          \n            }\n        }\n        return c;\n        \n    }\n};\n//\uD83D\uDCA1 count() takes O(1) time in an unordered set!\n\n
['Array', 'Hash Table', 'String', 'Bit Manipulation', 'C++']