Leetcode 692 Solution
This article provides solution to leetcode question 692 (top-k-frequent-words)
Access this page by simply typing in "lcs 692" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
class Solution: def topKFrequent(self, words: List[str], k: int) -> List[str]: m = collections.defaultdict(int) for word in words: m[word] += 1 d =  for word, cnt in m.items(): d.append((-cnt, word)) d.sort() return [word for _, word in d[:k]]