jpmorgan面试,经过我们的面试辅助和代面试等服务的支持,恭喜我们的客户上岸JPM!
我们一起来看看其中一道面试真题吧。
Given an integer array nums
and an integer k
, return the k
most frequent elements. You may return the answer in any order.
Example 1:
makefileCopy codeInput: nums = [1,1,1,2,2,3], k = 2
Output: [1,2]
Example 2:
makefileCopy codeInput: nums = [1], k = 1
Output: [1]
Constraints:
- 1≤nums.length≤1051≤nums.length≤105
- −104≤nums[i]≤104−104≤nums[i]≤104
- 𝑘k is in the range [1, the number of unique elements in the array].
- It is guaranteed that the answer is unique.
如果你也对JPM感兴趣,欢迎联系我们。查看我们的服务价格,代面试,面试辅助,简历编写和算法私教等等,应有尽有。