Skip to content

Commit 4048621

Browse files
author
MJ Kang
committed
eol
1 parent a309b1e commit 4048621

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from typing import List
22

3+
34
class Solution:
45
def topKFrequent(self, nums: List[int], k: int) -> List[int]:
56
countDict = {}
@@ -8,8 +9,8 @@ def topKFrequent(self, nums: List[int], k: int) -> List[int]:
89
countDict[num] += 1
910
else:
1011
countDict[num] = 1
11-
sortedDictList = sorted(countDict.items(), key=lambda item: item[1], reverse = True)
12+
sortedDictList = sorted(countDict.items(), key=lambda item: item[1], reverse=True)
1213
freqElements = []
1314
for i in range(k):
1415
freqElements.append(sortedDictList[i][0])
15-
return freqElements
16+
return freqElements

0 commit comments

Comments
 (0)