1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-13 19:31:42 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
Files
leetcode-problemset/leetcode-cn/problem (Chinese)/可以输入的最大单词数 [maximum-number-of-words-you-can-type].html
2022-03-29 12:43:11 +08:00

39 lines
1.6 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>键盘出现了一些故障,有些字母键无法正常工作。而键盘上所有其他键都能够正常工作。</p>
<p>给你一个由若干单词组成的字符串 <code>text</code> ,单词间由单个空格组成(不含前导和尾随空格);另有一个字符串 <code>brokenLetters</code> ,由所有已损坏的不同字母键组成,返回你可以使用此键盘完全输入的 <code>text</code> 中单词的数目。</p>
<p> </p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>text = "hello world", brokenLetters = "ad"
<strong>输出:</strong>1
<strong>解释:</strong>无法输入 "world" ,因为字母键 'd' 已损坏。
</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>text = "leet code", brokenLetters = "lt"
<strong>输出:</strong>1
<strong>解释:</strong>无法输入 "leet" ,因为字母键 'l' 和 't' 已损坏。
</pre>
<p><strong>示例 3</strong></p>
<pre><strong>输入:</strong>text = "leet code", brokenLetters = "e"
<strong>输出:</strong>0
<strong>解释:</strong>无法输入任何单词,因为字母键 'e' 已损坏。
</pre>
<p> </p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= text.length &lt;= 10<sup>4</sup></code></li>
<li><code>0 &lt;= brokenLetters.length &lt;= 26</code></li>
<li><code>text</code> 由若干用单个空格分隔的单词组成,且不含任何前导和尾随空格</li>
<li>每个单词仅由小写英文字母组成</li>
<li><code>brokenLetters</code><strong>互不相同</strong> 的小写英文字母组成</li>
</ul>