Problem 792 · Medium

Number of Matching Subsequences

Park each word in the bucket of the next letter it waits for, and advance buckets as s is scanned once.

Open the interactive visualisation