Difficulty
Easy
Language
Python
Solution 1 - Allowed Set
A word is consistent if all its characters are in allowed.
""" 1684.1 - Count the Number of Consistent Strings - Solution 1 - Allowed Set """
from typing import List
class Solution:
def countConsistentStrings(self, allowed: str, words: List[str]) -> int:
allowed_set = set(allowed)
return sum(all(c in allowed_set for c in w) for w in words)