1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/长按键入 [long-pressed-name].html
2022-03-29 12:43:11 +08:00

31 lines
1.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

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>你的朋友正在使用键盘输入他的名字&nbsp;<code>name</code>。偶尔,在键入字符&nbsp;<code>c</code>&nbsp;时,按键可能会被<em>长按</em>,而字符可能被输入 1 次或多次。</p>
<p>你将会检查键盘输入的字符&nbsp;<code>typed</code>。如果它对应的可能是你的朋友的名字(其中一些字符可能被长按),那么就返回&nbsp;<code>True</code></p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>name = "alex", typed = "aaleex"
<strong>输出:</strong>true
<strong>解释:</strong>'alex' 中的 'a' 和 'e' 被长按。
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>name = "saeed", typed = "ssaaedd"
<strong>输出:</strong>false
<strong>解释:</strong>'e' 一定需要被键入两次,但在 typed 的输出中不是这样。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= name.length, typed.length &lt;= 1000</code></li>
<li><code>name</code>&nbsp;<code>typed</code>&nbsp;的字符都是小写字母</li>
</ul>