Back to problems

Find Dictionary Words Represented by Repeated Letters

Algorithm · Waymo · Medium

Given a target string text and a list of dictionary words, you need to find every dictionary word that could have produced text by repeating each of its characters in place one or more times. This process does not delete or rearrange any letters; each character occurrence in the original word is expanded into a contiguous block of the same letter, with no upper bound on the length of expansion. Thus, a word matches text exactly when: They have the same sequence of run…

Checking your access…