Leetcode - Top K Frequent Elements (Python)

preview_player
Показать описание
July 2020 Leetcode Challenge
Leetcode - Top K Frequent Elements
Рекомендации по теме
Комментарии
Автор

Hi Timothy, Your videos are extremely helpful! I have a question. How to write a function most_occurred_k that takes a list of strings and an integer k, and that
returns a dictionary where the keys are the top n most frequent unique words in the list, and
the values are the frequency of each word?

benlam
Автор

nice video tim! for you heap solution. whats the time complexity for using heapify? i've never seen this before

janmichaelaustria
Автор

Is complexity of this solution better than nlogn? probably no.

suketu
Автор

This would fail if the counter has equal counts > [4, 1, -1, 2, -1, 2, 3]
and k =2?

nishthapranabbhattacharjee
Автор

This was very helpful, I appreciate it. I am on the leetcode grind and man it can get exhausting haha

markmariscal
Автор

Solution doesn't work anymore!! Otherwise great video as always

rsKayiira