Code Room
CodingEasycod-g879
Subject TokenizationLevel Entry–Mid~20 minCommon in Algorithms & data structures interviewsIndustries Software development

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.

Implement
top_k_words(text: str, stopwords: list[str], k: int) → list[str]
Examples
in["the cat sat on the mat the cat",["the","on"],2]out["cat","mat"]
What a strong answer looks like

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.

Run or narrate your approach, then ask the coach.