Skip to content

Commit 4079e69

Browse files
committed
Create README - LeetHub
1 parent d81fb62 commit 4079e69

File tree

1 file changed

+37
-0
lines changed
  • count-the-number-of-consistent-strings

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<h2>1684. Count the Number of Consistent Strings</h2><h3>Easy</h3><hr><div><p>You are given a string <code>allowed</code> consisting of <strong>distinct</strong> characters and an array of strings <code>words</code>. A string is <strong>consistent </strong>if all characters in the string appear in the string <code>allowed</code>.</p>
2+
3+
<p>Return<em> the number of <strong>consistent</strong> strings in the array </em><code>words</code>.</p>
4+
5+
<p>&nbsp;</p>
6+
<p><strong>Example 1:</strong></p>
7+
8+
<pre><strong>Input:</strong> allowed = "ab", words = ["ad","bd","aaab","baa","badab"]
9+
<strong>Output:</strong> 2
10+
<strong>Explanation:</strong> Strings "aaab" and "baa" are consistent since they only contain characters 'a' and 'b'.
11+
</pre>
12+
13+
<p><strong>Example 2:</strong></p>
14+
15+
<pre><strong>Input:</strong> allowed = "abc", words = ["a","b","c","ab","ac","bc","abc"]
16+
<strong>Output:</strong> 7
17+
<strong>Explanation:</strong> All strings are consistent.
18+
</pre>
19+
20+
<p><strong>Example 3:</strong></p>
21+
22+
<pre><strong>Input:</strong> allowed = "cad", words = ["cc","acd","b","ba","bac","bad","ac","d"]
23+
<strong>Output:</strong> 4
24+
<strong>Explanation:</strong> Strings "cc", "acd", "ac", and "d" are consistent.
25+
</pre>
26+
27+
<p>&nbsp;</p>
28+
<p><strong>Constraints:</strong></p>
29+
30+
<ul>
31+
<li><code>1 &lt;= words.length &lt;= 10<sup>4</sup></code></li>
32+
<li><code>1 &lt;= allowed.length &lt;=<sup> </sup>26</code></li>
33+
<li><code>1 &lt;= words[i].length &lt;= 10</code></li>
34+
<li>The characters in <code>allowed</code> are <strong>distinct</strong>.</li>
35+
<li><code>words[i]</code> and <code>allowed</code> contain only lowercase English letters.</li>
36+
</ul>
37+
</div>

0 commit comments

Comments
 (0)