Check Whether a Word Matches a Numeric Abbreviation Like i18n
Last updated: November 29, 2026
Quick Overview
Given a word and an abbreviation in which runs of digits mean "skip that many letters" (for example "i18n" for "internationalization"), decide whether the abbreviation is valid for the word; numbers may not have leading zeros.
0
0
0 solved
Given a word and an abbreviation in which runs of digits mean "skip that many letters" (for example "i18n" for "internationalization"), decide whether the abbreviation is valid for the word; numbers may not have leading zeros.
Google engineers use numeronyms like i18n, l10n, and a11y daily, which makes this a natural screen question. The interviewer is checking two-pointer discipline, multi-digit number parsing, and the leading-zero and overrun edge cases.
What the Interviewer Expects
- Uses two pointers, one into the word and one into the abbreviation
- Parses multi-digit skip counts rather than single digits
- Rejects leading zeros, including a lone zero
- Checks that both pointers end exactly at their string ends
- Walks through an example with a two-digit count
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- Generate every valid abbreviation of a word.
- Find the shortest abbreviation of a word that matches no word in a dictionary.
- What changes if the abbreviation may also use wildcard letters?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
- Input:
word(lowercase letters) andabbr(letters and digits). - A digit run
kmeans skip exactlykcharacters ofword; letters must match exactly. - Leading zeros are invalid (
a03e), an...
High-Level Design
Keep i into the word and j into the abbreviation. When abbr[j] is a letter, compare and advance both. When it is a digit, read the full number, then jump i forward by that amount. Overshooting...