blob: e4b0e12426156044593776abfe854931147f61c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
"""
Question
Top K Elements in List
Given an integer array nums and an integer k, return the k most frequent elements within the array.
The test cases are generated such that the answer is always unique.
You may return the output in any order.
Example 1:
Input: nums = [1,2,2,3,3,3], k = 2
Output: [2,3]
Example 2:
Input: nums = [7,7], k = 1
Output: [7]
Constraints:
1 <= nums.length <= 10^4.
-1000 <= nums[i] <= 1000
1 <= k <= number of distinct elements in nums.
"""
class Solution:
def fn_name(self, parameters) -> return_type:
return return
case1 = case1
case2 = case2
case3 = case3
solution = Solution()
print(f" fn_name case1: {solution.fn_name(case1args)}")
print(f" fn_name case2: {solution.fn_name(case2args)}")
print(f" fn_name case3: {solution.fn_name(case3args)}")
"""
Solution
url: url
video: video
code:
```fn_name
code
```
"""
|