File tree Expand file tree Collapse file tree 1 file changed +1
-2
lines changed Expand file tree Collapse file tree 1 file changed +1
-2
lines changed Original file line number Diff line number Diff line change 55// [ํ์ด]
66// 1. <์ซ์: ๋น๋์>๋ฅผ ์ ์ฅํ๋ HashMap๊ณผ [๋น๋์, ์ซ์]๋ฅผ ์ ์ฅํ๋ PriorityQueue๋ฅผ ์ ์ธํ๋ค.
77// 2. HashMap์ ์ซ์๋ณ๋ก ๋น๋์๋ฅผ ํจ๊ป ์ ์ฅํด์ ํด์ํ
์ด๋ธ์ ๋ง๋ ๋ค.
8- // 3.
98// [์ฐ์ ์์ ํ์ ์ฌ์ฉ๋ ์๋ฃ๊ตฌ์กฐ]
109// 1. ๋ณ๋ ํด๋์ค๋ฅผ ์ ์ธ
1110// 2. ์๊ตฌ์ฌํญ ์๋ฃํ ๋ฐฐ์ด์ ์ ์ธํ๋ค.
1514// 1. ์ฐ์ ์์ ํ๋ ๋งค๋ฒ ์์๊ฐ ์ถ๊ฐ๋ ๋๋ง๋ค ๋ด๋ถ ์ ๋ ฌ์ ์ํํ๊ธฐ ๋๋ฌธ์ ์ฐ์ฐ์ ์ํํ๋ฉด์ k๊ฐ๋ฅผ ์ ์งํด์ผ ํ๋ค.
1615// ๋ํ ๊ธฐ์กด [๋น๋์, ์ซ์]๋ฅผ ๋ฒ๋ ค์ผ๋ง ์ฌ๋ฐ๋ฅธ ๋ต์ ๋์ถํ ์ ์์๋ค.
1716// 2. [์ซ์, ๋น๋์]๋ก ์ ์ฅํ๋ ๊ฒ๋ง ์๊ฐํ๋๋ ๋ด๋ถ ์ ๋ ฌ์ ์ด๋ป๊ฒ ํ์ง ๋ชปํด์ ๊ต์ฅํ ๊ณ ๋ฏผํ๋ค. ์ ๋ต์ ๋ฐ๋์๋ค.
18- //
17+
1918class Solution {
2019 public int [] topKFrequent (int [] nums , int k ) {
2120 int [] answer = new int [k ];
You canโt perform that action at this time.
0 commit comments