当前位置:网站首页>The kth largest element in the array
The kth largest element in the array
2022-07-04 19:21:00 【charlsdm】
- The... In the array K The biggest element
Given an array of integers nums And integer k, Please return the... In the array k The biggest element .
Please note that , What you need to look for is the number after array sorting k The biggest element , Not the first. k A different element .
Example 1:
Input : [3,2,1,5,6,4] and k = 2
Output : 5
Example 2:
Input : [3,2,3,1,2,4,5,5,6] and k = 4
Output : 4
my C#AC Code ` public partial class Solution
{
public int FindKthLargest(int[] nums, int k)
{
List<int> mynums = nums.ToList();
mynums.Sort();
mynums.Reverse();
return mynums[k-1];
}
}
边栏推荐
- Is the securities account opened by qiniu safe?
- 工厂从自动化到数字孪生,图扑能干什么?
- Caché JSON 使用JSON适配器
- Scala基础教程--15--递归
- 模板_判断素数_开方 / 六素数法
- [opencv introduction to mastery 9] opencv video capture, image and video conversion
- Unity给自己的脚本添加类似编辑器扩展的功能案例ContextMenu的使用
- Bi skills - permission axis
- Scala基础教程--14--隐式转换
- 使用canal配合rocketmq监听mysql的binlog日志
猜你喜欢
![[release] a tool for testing WebService and database connection - dbtest v1.0](/img/4e/4154fec22035725d6c7aecd3371b05.jpg)
[release] a tool for testing WebService and database connection - dbtest v1.0

DeFi生态NFT流动性挖矿系统开发搭建

How is the entered query SQL statement executed?

使用canal配合rocketmq监听mysql的binlog日志

Scala basic tutorial -- 20 -- akka

Go microservice (II) - detailed introduction to protobuf

Wanghongru research group of Institute of genomics, Chinese Academy of Agricultural Sciences is cordially invited to join

用实际例子详细探究OpenCV的轮廓绘制函数drawContours()

基于unity的愤怒的小鸟设计

One question per day (2022-07-02) - Minimum refueling times
随机推荐
Rookie post station management system based on C language
26. 删除有序数组中的重复项 C#解答
【机器学习的数学基础】(一)线性代数(Linear Algebra)(上+)
Scala基础教程--18--集合(二)
Perfect JS event delegation
A method of using tree LSTM reinforcement learning for connection sequence selection
[release] a tool for testing WebService and database connection - dbtest v1.0
2019年蜀山区第十五届青少年信息学竞赛
26. Delete the duplicate item C solution in the ordered array
6.26cf simulation match B: solution to array reduction problem
What if the self incrementing ID of online MySQL is exhausted?
千万不要只学 Oracle、MySQL!
IBM WebSphere MQ检索邮件
6.26CF模拟赛E:价格最大化题解
读写关闭的channel是啥后果?
TorchDrug教程
How is the entered query SQL statement executed?
Lex and yacc based lexical analyzer + parser
[go ~ 0 to 1] read, write and create files on the sixth day
其他InterSystems %Net工具