当前位置:网站首页>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];
}
}
边栏推荐
- My colleagues quietly told me that flying Book notification can still play like this
- Using SSH
- [uniapp] uniapp development app online Preview PDF file
- 2022-07-04: what is the output of the following go language code? A:true; B:false; C: Compilation error. package main import 'fmt' func
- Is Guoyuan futures a regular platform? Is it safe to open an account in Guoyuan futures?
- Scala基础教程--18--集合(二)
- Use canal and rocketmq to listen to MySQL binlog logs
- 信息学奥赛一本通 1336:【例3-1】找树根和孩子
- redis分布式锁的8大坑总结梳理
- 数组中的第K个最大元素
猜你喜欢
OpenCV的二值化处理函数threshold()详解
A method of using tree LSTM reinforcement learning for connection sequence selection
Wireshark网络抓包
奥迪AUDI EDI INVOIC发票报文详解
用实际例子详细探究OpenCV的轮廓绘制函数drawContours()
Go microservice (II) - detailed introduction to protobuf
[release] a tool for testing WebService and database connection - dbtest v1.0
Build your own website (15)
node_exporter部署
2022CoCa: Contrastive Captioners are Image-Text Fountion Models
随机推荐
Mxnet implementation of googlenet (parallel connection network)
Lex and yacc based lexical analyzer + parser
[opencv introduction to mastery 9] opencv video capture, image and video conversion
[mathematical basis of machine learning] (I) linear algebra (Part 1 +)
LeetCode 赎金信 C#解答
Rookie post station management system based on C language
Li Kou brush question diary /day2/2022.6.24
Unity给自己的脚本添加类似编辑器扩展的功能案例ContextMenu的使用
模板_大整数减法_无论大小关系
建立自己的网站(15)
请教一下 flinksql中 除了数据统计结果是状态被保存 数据本身也是状态吗
性能优化之关键渲染路径
Using FTP
Bi skills - permission axis
[go ~ 0 to 1] read, write and create files on the sixth day
2022-07-04:以下go语言代码输出什么?A:true;B:false;C:编译错误。 package main import 'fmt' func
26. Delete the duplicate item C solution in the ordered array
Scala基础教程--13--函数进阶
信息学奥赛一本通 1336:【例3-1】找树根和孩子
Cache é JSON uses JSON adapters