mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-13 11:21:42 +08:00
add leetcode problem-cn part3
This commit is contained in:
30
算法题(国内版)/problem (Chinese)/长按键入 [long-pressed-name].html
Normal file
30
算法题(国内版)/problem (Chinese)/长按键入 [long-pressed-name].html
Normal file
@@ -0,0 +1,30 @@
|
||||
<p>你的朋友正在使用键盘输入他的名字 <code>name</code>。偶尔,在键入字符 <code>c</code> 时,按键可能会被<em>长按</em>,而字符可能被输入 1 次或多次。</p>
|
||||
|
||||
<p>你将会检查键盘输入的字符 <code>typed</code>。如果它对应的可能是你的朋友的名字(其中一些字符可能被长按),那么就返回 <code>True</code>。</p>
|
||||
|
||||
<p> </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> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= name.length, typed.length <= 1000</code></li>
|
||||
<li><code>name</code> 和 <code>typed</code> 的字符都是小写字母</li>
|
||||
</ul>
|
Reference in New Issue
Block a user