Back to problems

Valid Word Abbreviation (LeetCode 408) with Follow-Up Variant

Algorithm · Salesforce · Medium

Given a non‑empty string word composed of lowercase English letters, and a candidate abbreviation string abbr consisting of lowercase letters and digits, determine whether abbr is a legitimate abbreviation of word. An abbreviation may contain numeric tokens. Each numeric token represents how many consecutive characters from word should be skipped. A run of adjacent digits forms a single token; the token’s integer value is the skip count. Literal letters in abbr must match…

Checking your access…