Skip to content

Commit ccb9a7b

Browse files
author
jinvicky
committed
top k frequent 복습 및 주석 갱신
1 parent 9566af8 commit ccb9a7b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

top-k-frequent-elements/jinvicky.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ public int[] topKFrequent(int[] nums, int k) {
1616
* 결과배열에 할당할 때는 그냥 앞에서부터 하면 된다.
1717
* 이미 k개를 만족했고, 빈도수가 낮 -> 높 순서대로 그대로 쌓으면 된다.
1818
*
19-
* 우선순위큐에 할당할 때 [숫자, 빈도수]로 생각했지만, [빈도수, 숫자]가 맞았다.
19+
* 우선순위큐에 할당할 때 [숫자, 빈도수]냐 [빈도수, 숫자] 냐는 별 상관이 없다.
20+
* 1. 우선순위 큐 초기화
21+
* 2. 결과배열에 값 할당할 때 참조하는 [인덱스]
2022
*/
2123
int[] answer = new int[k];
2224

0 commit comments

Comments
 (0)