Brute Force Approch || Beats 67% in Runtime and 83% in Memory
Intuition\nThe problem asks us to find how many strings in the list words consist only of characters found in the allowed string. To solve this efficiently, we 
# Intuition\nThe problem asks us to find how many strings in the list `words` consist only of characters found in the `allowed` string. To solve this efficiently, we can use a dictionary to keep track of which characters are allowed. This allows us to quickly check if each character in a word is valid.\n\n# Approach\n\n1. **Dictionary Setup:**\nWe first create a dictionary `allowed_str` that contains all lowercase English letters. Initially, all characters are set to False, meaning none of the characters are allowed yet.\n\n2. **Mark Allowed Characters:**\nFor each character in the `allowed` string, we mark the corresponding dictionary entry as True to indicate that this character is valid.\n\n3. **Check Each Word:**\nWe loop through each word in the `words` list:\n\nFor each word, we set a flag `flag = True` indicating that the word is valid until proven otherwise.\nWe then iterate over each character in the word. If any character is not marked as allowed in the `allowed_str` dictionary, we set `flag = False` and break the loop for that word.\nIf the word passes the check (i.e., all characters are allowed), we increment the result counter.\n4. **Return Result:**\nAfter processing all words, the result counter gives the number of consistent strings, which is returned.\n\n# Complexity\n- Time complexity:\n- O(1) for initializing the dictionary with 26 letters (since there are only 26 lowercase English letters).\n- `O(n * m)` for checking each character of each word, where n is the number of words and m is the average length of each word. Therefore, the overall time complexity is `O(n * m)`.\n\n- Space complexity:\n- O(1) for the `allowed_str` dictionary, which always has 26 entries regardless of input size.\n- The space complexity for the input `words` and `allowed` string is not included in the analysis as they are part of the input. Hence, the space complexity of the solution is O(1).\n\n# Code\n```python3 []\nclass Solution:\n    def countConsistentStrings(self, allowed: str, words: List[str]) -> int:\n        # Brute Force Method\n        allowed_str = {}\n\n        for i in range(97, 123):\n            allowed_str[chr(i)] = False\n\n        for i in allowed:\n            allowed_str[i] = True\n\n        res = 0\n        for i in words:\n            flag = True\n            for j in i:\n                if allowed_str[j] == False:\n                    flag = False\n            if flag:\n                res += 1\n\n        return (res)\n```
['Array', 'Hash Table', 'Python3']