Skip to content

Commit 0066475

Browse files
author
jinbeom
committed
Top K Frequent Elements Solution
1 parent d842c9f commit 0066475

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

top-k-frequent-elements/kayden.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from collections import Counter
2+
3+
class Solution:
4+
def topKFrequent(self, nums: List[int], k: int) -> List[int]:
5+
return [num for num, count in Counter(nums).most_common(k)]

0 commit comments

Comments
 (0)