Long Pressed Name
Check whether typed text could be a name with some keys held down, walking the name and the typed text side by side.
01The problem
Your friend typed their name, but some keys may have been long pressed, repeating a letter one or more extra times. Given what was typed, return true if it could be the name with some long presses.
| name | typed | Output | Why |
|---|---|---|---|
"alex" | "aaleex" | true | a and e held |
"saeed" | "ssaaedd" | false | one e missing |
Constraints: length 1 to 1000, lowercase letters; typed may be longer.
Loading the rest of the lesson…