Solution: Valid Word Abbreviation
Understand how to apply the two pointers technique to determine if a word abbreviation is valid. This lesson guides you through checking each character and handling numeric abbreviations by skipping the correct number of characters while avoiding leading zeros in numbers. You will learn a step-by-step approach to iterate through the word and abbreviation simultaneously and confirm if they correspond correctly.
We'll cover the following...
Statement
Given a string, word, and abbreviation, abbr, return TRUE if the abbreviation matches the given string. Otherwise, return FALSE. An abbreviation can replace any non-adjacent, non-empty substrings of the original word with their lengths. Replacement lengths must not contain leading zeros.
A certain word, "calendar", can be abbreviated as follows:
"cal3ar"("cal +end[length = 3] + ar"skipping three ...