Skip to content

Commit 912848a

Browse files
committed
줄바꿈 누락 처리 수정
1 parent ce6a63e commit 912848a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

top-k-frequent-elements/gmlwls96.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ class Solution {
22
fun topKFrequent(nums: IntArray, k: Int): IntArray {
33
val answer = IntArray(k)
44
val set = nums.toSet()
5-
val mutableList = mutableListOf<Pair<Int,Int>>()
5+
val mutableList = mutableListOf<Pair<Int, Int>>()
66
set.forEach { num ->
7-
mutableList.add(num to nums.count { it == num})
7+
mutableList.add(num to nums.count { it == num })
88
}
99
mutableList.sortByDescending { it.second }
10-
for (i in 0 until k){
10+
for (i in 0 until k) {
1111
answer[i] = mutableList[i].first
1212
}
1313
return answer
1414
}
15-
}
15+
}

0 commit comments

Comments
 (0)