Skip to content

Commit 424d866

Browse files
committed
Create README - LeetHub
source:faada7761d081adebd6daebdf14a245c25a12981
1 parent 9d9e6f1 commit 424d866

File tree

1 file changed

+39
-0
lines changed
  • 공예영/3주차/0347-top-k-frequent-elements

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<h2><a href="https://leetcode.com/problems/top-k-frequent-elements">347. Top K Frequent Elements</a></h2><h3>Medium</h3><hr><p>Given an integer array <code>nums</code> and an integer <code>k</code>, return <em>the</em> <code>k</code> <em>most frequent elements</em>. You may return the answer in <strong>any order</strong>.</p>
2+
3+
<p>&nbsp;</p>
4+
<p><strong class="example">Example 1:</strong></p>
5+
6+
<div class="example-block">
7+
<p><strong>Input:</strong> <span class="example-io">nums = [1,1,1,2,2,3], k = 2</span></p>
8+
9+
<p><strong>Output:</strong> <span class="example-io">[1,2]</span></p>
10+
</div>
11+
12+
<p><strong class="example">Example 2:</strong></p>
13+
14+
<div class="example-block">
15+
<p><strong>Input:</strong> <span class="example-io">nums = [1], k = 1</span></p>
16+
17+
<p><strong>Output:</strong> <span class="example-io">[1]</span></p>
18+
</div>
19+
20+
<p><strong class="example">Example 3:</strong></p>
21+
22+
<div class="example-block">
23+
<p><strong>Input:</strong> <span class="example-io">nums = [1,2,1,2,1,2,3,1,3,2], k = 2</span></p>
24+
25+
<p><strong>Output:</strong> <span class="example-io">[1,2]</span></p>
26+
</div>
27+
28+
<p>&nbsp;</p>
29+
<p><strong>Constraints:</strong></p>
30+
31+
<ul>
32+
<li><code>1 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>
33+
<li><code>-10<sup>4</sup> &lt;= nums[i] &lt;= 10<sup>4</sup></code></li>
34+
<li><code>k</code> is in the range <code>[1, the number of unique elements in the array]</code>.</li>
35+
<li>It is <strong>guaranteed</strong> that the answer is <strong>unique</strong>.</li>
36+
</ul>
37+
38+
<p>&nbsp;</p>
39+
<p><strong>Follow up:</strong> Your algorithm&#39;s time complexity must be better than <code>O(n log n)</code>, where n is the array&#39;s size.</p>

0 commit comments

Comments
 (0)