FastPrepValid Word Abbreviation
Problems/Valid Word Abbreviation

Valid Word Abbreviation

Meta logoMeta● EasyFULLTIMEPHONE SCREEN
QuestionFunctionExamplesConstraints

Problem statement

Source note: The interview report directly names the standard word-abbreviation validation task. This practice contract preserves numeric skips and the no-leading-zero rule.

Given a lowercase word and an abbreviation, determine whether the abbreviation represents the word.

A positive decimal number skips that many consecutive characters. A number may not start with 0.

Function

validWordAbbreviation(word: String, abbreviation: String) → boolean

Examples

Example 1

word = "internationalization"abbreviation = "i12iz4n"return = true

The numeric parts skip 12 and 4 characters, and every literal matches.

Example 2

word = "apple"abbreviation = "a2e"return = false

After skipping two characters, the abbreviation expects e where the word has l.

Constraints

  • 1 <= word.length, abbreviation.length <= 100
  • word contains lowercase English letters.
  • abbreviation contains lowercase English letters and digits.

More Meta problems

  • Count Events in Rolling Minute WindowsPHONE SCREEN · Seen Oct 2026
  • Shortest Path in a Binary MatrixPHONE SCREEN · Seen Sep 2026
  • Deterministic K-Means AssignmentsPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
All Meta interview questionsSee Meta hiring insights
Saved
public boolean validWordAbbreviation(String word, String abbreviation) {
    // Write your code here.
}
Checking account…