We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4d07d50 commit 72b43d1Copy full SHA for 72b43d1
top-k-frequent-elements/oddong.py
@@ -0,0 +1,5 @@
1
+import collections
2
+
3
+class Solution:
4
+ def topKFrequent(self, nums: List[int], k: int) -> List[int]:
5
+ return [num for num, cnt in collections.Counter(nums).most_common(k)]
0 commit comments