def topKFrequent(self, nums, k):
for i in range(k):
@YangFan Even simpler solution
return [x for x in collections.Counter(nums).most_common(k)]
@binoymichael Good one-line solution using most_common function! Thank you for sharing!
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.