Question
Given a block of text, a list of stopwords, and an integer `k`, return the `k` most frequent words. Words are maximal runs of alphabetic characters, compared case-insensitively (lowercase everything). Discard any word in the stopword set. Break ties between equally frequent words alphabetically (ascending). Return at most `k` words as a list, most frequent first.
top_k_words(text: str, stopwords: list[str], k: int) → list[str]["the cat sat on the mat the cat",["the","on"],2]out["cat","mat"]State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.