Problem
Ask
Submissions

Problem: Top K Frequent Words

Medium
30 min
Explore how to identify the top K frequent words from a list by combining frequency sorting with lexicographical order. Understand using trie data structures for efficient search and retrieval in coding interviews.

Statement

Given a list of strings words and an integer k, return the k most frequently occurring strings.

Note: The result should be sorted in descending order based on frequency. If multiple words have the same frequency, they should be sorted in lexicographical order.

Constraints:

  • 11 \leq words.length 100\leq 100

  • 11 \leq words[i].length 10\leq 10

  • 11 \leqk \leq number of unique words in the list

  • words[i] consists of lowercase English letters.

Problem
Ask
Submissions

Problem: Top K Frequent Words

Medium
30 min
Explore how to identify the top K frequent words from a list by combining frequency sorting with lexicographical order. Understand using trie data structures for efficient search and retrieval in coding interviews.

Statement

Given a list of strings words and an integer k, return the k most frequently occurring strings.

Note: The result should be sorted in descending order based on frequency. If multiple words have the same frequency, they should be sorted in lexicographical order.

Constraints:

  • 11 \leq words.length 100\leq 100

  • 11 \leq words[i].length 10\leq 10

  • 11 \leqk \leq number of unique words in the list

  • words[i] consists of lowercase English letters.