FunctionRacerProblemsRace

Long Pressed Name

EasyTwo pointersPython, JavaScript, TypeScript, Java, C++

While typing your name, a key may get held down so a letter is typed one or more extra times. Return True if typed could be name with some letters long pressed (each letter typed at least once, in the right order), otherwise False.

Example 1

name "alex"
typed "aaleex"
returns true

a and e were held down.

Example 2

name "saeed"
typed "ssaaedd"
returns false

The second e is missing.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Two pointers problems