Search⌘ K
AI Features

DIY: Expressive words

Explore how to implement the expressiveWords function in Kotlin to count stretchy words that match a target string by extending character groups. This lesson helps you understand how to compare strings with extended characters and solve related coding interview problems.

Problem statement

Given a string, S, and an array of words, return the number of words that are stretchy.

A word in words is stretchy with respect to S if S can be derived by extending the letters of the word. Here is the extend rule:

...