Top K Frequent Words
Medium
Sorting & Searching (Misc)
Given a list of words and k, print the k most frequent words, ordered by frequency descending and alphabetically for equal frequencies. Print them on a single line.
Constraints
1 <= k <= number of distinct words <= n <= 500
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.