...

/

Solution: Valid Word Abbreviation

Solution: Valid Word Abbreviation

Let’s solve the Valid Word Abbreviation problem using Two Pointers.

Statement

Given a string word and an abbreviation abbr, return TRUE if the abbreviation matches the given string. Otherwise, return FALSE.

A certain word "calendar" can be abbreviated as follows:

  • "cal3ar" ("cal end ar" skipping three characters "end" from the word "calendar" still matches the provided abbreviation)

  • "c6r" ("c alenda r" skipping six characters "alenda" from the word "calendar" still matches the provided abbreviation)

The word ...

Access this course and 1400+ top-rated courses and projects.