Tap here to switch tabs
Problem
Submissions

Problem: Count the Number of Consistent Strings

Count the Number of Consistent Strings checks an array of words against an allowed set of distinct characters. Return how many words use only characters from that set.

Statement

You are given a string allowed consisting of distinct characters and an array of strings words. A string is considered consistent if every character in it appears in the string allowed.

Return the total number of consistent strings in the array words.

Constraints:

  • 1≤1 \leq words.length ≤104\leq 10^4

  • 1≤1 \leq allowed.length ≤26\leq 26

  • 1≤1 \leq words[i].length ≤10\leq 10

  • The characters in allowed are distinct.

  • words[i] and allowed contain only lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count the Number of Consistent Strings

Count the Number of Consistent Strings checks an array of words against an allowed set of distinct characters. Return how many words use only characters from that set.

Statement

You are given a string allowed consisting of distinct characters and an array of strings words. A string is considered consistent if every character in it appears in the string allowed.

Return the total number of consistent strings in the array words.

Constraints:

  • 1≤1 \leq words.length ≤104\leq 10^4

  • 1≤1 \leq allowed.length ≤26\leq 26

  • 1≤1 \leq words[i].length ≤10\leq 10

  • The characters in allowed are distinct.

  • words[i] and allowed contain only lowercase English letters.