|
| 1 | +<h2><a href="https://leetcode.com/problems/maximum-number-of-words-you-can-type">Maximum Number of Words You Can Type</a></h2> <img src='https://img.shields.io/badge/Difficulty-Easy-brightgreen' alt='Difficulty: Easy' /><hr><p>There is a malfunctioning keyboard where some letter keys do not work. All other keys on the keyboard work properly.</p> |
| 2 | + |
| 3 | +<p>Given a string <code>text</code> of words separated by a single space (no leading or trailing spaces) and a string <code>brokenLetters</code> of all <strong>distinct</strong> letter keys that are broken, return <em>the <strong>number of words</strong> in</em> <code>text</code> <em>you can fully type using this keyboard</em>.</p> |
| 4 | + |
| 5 | +<p> </p> |
| 6 | +<p><strong class="example">Example 1:</strong></p> |
| 7 | + |
| 8 | +<pre> |
| 9 | +<strong>Input:</strong> text = "hello world", brokenLetters = "ad" |
| 10 | +<strong>Output:</strong> 1 |
| 11 | +<strong>Explanation:</strong> We cannot type "world" because the 'd' key is broken. |
| 12 | +</pre> |
| 13 | + |
| 14 | +<p><strong class="example">Example 2:</strong></p> |
| 15 | + |
| 16 | +<pre> |
| 17 | +<strong>Input:</strong> text = "leet code", brokenLetters = "lt" |
| 18 | +<strong>Output:</strong> 1 |
| 19 | +<strong>Explanation:</strong> We cannot type "leet" because the 'l' and 't' keys are broken. |
| 20 | +</pre> |
| 21 | + |
| 22 | +<p><strong class="example">Example 3:</strong></p> |
| 23 | + |
| 24 | +<pre> |
| 25 | +<strong>Input:</strong> text = "leet code", brokenLetters = "e" |
| 26 | +<strong>Output:</strong> 0 |
| 27 | +<strong>Explanation:</strong> We cannot type either word because the 'e' key is broken. |
| 28 | +</pre> |
| 29 | + |
| 30 | +<p> </p> |
| 31 | +<p><strong>Constraints:</strong></p> |
| 32 | + |
| 33 | +<ul> |
| 34 | + <li><code>1 <= text.length <= 10<sup>4</sup></code></li> |
| 35 | + <li><code>0 <= brokenLetters.length <= 26</code></li> |
| 36 | + <li><code>text</code> consists of words separated by a single space without any leading or trailing spaces.</li> |
| 37 | + <li>Each word only consists of lowercase English letters.</li> |
| 38 | + <li><code>brokenLetters</code> consists of <strong>distinct</strong> lowercase English letters.</li> |
| 39 | +</ul> |
0 commit comments