Count the Number of Consistent Strings Problem
Count the Number of Consistent Strings Problem — ExecCode Easy DSA Practice
Solve the Count the Number of Consistent Strings problem on ExecCode. Free online easy DSA practice in Arrays - Logic Building. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Description You are given a string allowed consisting of distinct characters and an array of strings words. Your task is to compute the required answer and return the number of consistent strings in the array words. A string is consistentif all characters in the string appear in the string allowed.
Examples
Input {"allowed": "ab", "words": ["ad", "bd", "aaab", "baa", "badab"]}; Output 2. Input {"allowed": "abc", "words": ["a", "b", "c", "ab", "ac", "bc", "abc"]}; Output 7
Constraints
1 <= words.length <= 10^4 1 <= allowed.length <=^26 1 <= words[i].length <= 10 The characters in allowed are distinct. words[i] and allowed contain only lowercase English letters.
Practice Count the Number of Consistent Strings free on ExecCode. Browse DSA problems, topic map, and placement guides.