Skip to content

Commit 71a19de

Browse files
authored
Update 347._Top_K_Frequent_Elements.md
1 parent 6144235 commit 71a19de

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

docs/Leetcode_Solutions/347._Top_K_Frequent_Elements.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,30 @@
1-
# 1. Two Sum 两数之和
1+
# 347. Top K Frequent Elements
22

3-
**<font color=red>难度: Easy</font>**
3+
**<font color=red>难度: Medium</font>**
44

55
## 刷题内容
66

77
> 原题连接
88
9-
* https://leetcode.com/problems/two-sum
10-
* https://leetcode-cn.com/problems/two-sum/description
9+
* https://leetcode.com/problems/top-k-frequent-elements/description/
1110

1211
> 内容描述
1312
1413
```
15-
给定 nums = [2, 7, 11, 15], target = 9
14+
Given a non-empty array of integers, return the k most frequent elements.
1615
17-
因为 nums[0] + nums[1] = 2 + 7 = 9
18-
所以返回 [0, 1]
16+
Example 1:
17+
18+
Input: nums = [1,1,1,2,2,3], k = 2
19+
Output: [1,2]
20+
Example 2:
21+
22+
Input: nums = [1], k = 1
23+
Output: [1]
24+
Note:
25+
26+
You may assume k is always valid, 1 ≤ k ≤ number of unique elements.
27+
Your algorithm's time complexity must be better than O(n log n), where n is the array's size.
1928
```
2029

2130
## 解题方案

0 commit comments

Comments
 (0)