Python 3 solution 100 faster than any other codes
We know that sets in python are actually implemented by hash tables, which means you can search a member in set by O(1). Therfore, first we create a set from al
- We know that sets in python are actually implemented by hash tables, which means you can search a member in set by `O(1)`. Therfore, first we create a set from `allowed` string and check that every letter of each word to be in the allowed string. If its not, we increase the `count`. By the end of the program we know the number of wrong words, so we just need to return the difference of `allowed` length and `count`\n- Complexity: `O(nd)`\nIf we assume we have `n` words, we should iterate on all of them and also iterate on each letter which we assumed the average length of words is `d`. So the time complexity is `O(nd)`.\n- Code:\n```\nclass Solution:\n    def countConsistentStrings(self, allowed: str, words: List[str]) -> int:\n        allowed = set(allowed)\n        count = 0\n        \n        for word in words:\n            for letter in word:\n                if letter not in allowed:\n                    count += 1\n                    break\n        \n        return len(words) - count\n```
['Python', 'Python3']