Document Target Words: Coverage, Counts and Shortest Passage

Asked at Snowflake · Coding Questions · Difficulty: Hard

You are given a text `document` and a list of `targets` (words to look for). Build three small tools on top of one shared word-matching rule. The first checks that the document contains every target word. The second counts how often each target appears. The third finds the shortest passage of the original text that contains all of them. Matching ignores case and punctuation, so the target `"isnt"` matches the word `"isn't"`.

Loading the problem…