LeetCode 925, Easy. Topics: Two Pointers, String. View on LeetCode.
Generate this problem as a practice environment: tested reference solution, 25 parametrized pytest cases, and a playground notebook:
Problem
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 friend’s name, with some characters (possibly none) being long pressed.
Examples
Constraints
- 1 <= name.length, typed.length <= 1000
- name and typed consist of only lowercase English letters.
Solution
Reference implementation from solution.py on GitHub, full suite in test_solution.py:
Complexity
Last modified on September 7, 2026