We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 56768db commit ab3dceeCopy full SHA for ab3dcee
TP/925.md
@@ -0,0 +1,29 @@
1
+## Long Pressed Name
2
+
3
+#### Description
4
5
+[link](https://leetcode.com/problems/long-pressed-name/discuss/183994/C%2B%2BJavaPython-Two-Pointers)
6
7
+---
8
9
+#### Solution
10
11
+- 保持长的字符串滑动,短的字符串每次匹配,当去除掉重复的时候都不等就是False
12
13
14
15
+#### Code
16
17
+O(m+n)
18
19
+```python
20
+class Solution:
21
+ def isLongPressedName(self, name: str, typed: str) -> bool:
22
+ i = 0
23
+ for j in range(len(typed)):
24
+ if i < len(name) and name[i] == typed[j]:
25
+ i += 1
26
+ elif j == 0 or typed[j] != typed[j - 1]:
27
+ return False
28
+ return i == len(name)
29
+```
0 commit comments