Coding (explain approach only): output the top-k most frequent words in an English article.
Asked in the Round 1 (technical) stage. Verbal, no live coding.
Implement top_k_frequent_words(article, k). Treat uppercase and lowercase forms as the same word. A word is a consecutive sequence of English letters, optionally containing an apostrophe between letter sequences. Ignore punctuation. Return the words ordered by decreasing frequency, breaking equal-frequency ties alphabetically.
article and integer k.k distinct normalized words.def top_k_frequent_words(article, k):