925. Long Pressed Name
Description
Your friend is typing his name into a keyboard. Sometimes, when typing a character c, the key might get long pressed, and the character will be typed 1 or more times.
You examine the typed characters of the keyboard. Return True if it is possible that it was your friends name, with some characters (possibly none) being long pressed.
Example 1:
1 | Input: name = "alex", typed = "aaleex" |
Example 2:
1 | Input: name = "saeed", typed = "ssaaedd" |
Constraints:
1 <= name.length, typed.length <= 1000nameandtypedconsist of only lowercase English letters.
Hints/Notes
- 2025/04/09 Q1
- two pointers
- Leetcode solution
Solution
Language: C++
1 | class Solution { |